Primer commit del sistema avantika sin cambios
This commit is contained in:
21
.htaccess
Executable file
21
.htaccess
Executable file
@@ -0,0 +1,21 @@
|
||||
#suPHP_ConfigPath /home/facturas/public_html/
|
||||
|
||||
RewriteEngine on
|
||||
RewriteRule ^index2/([^/\.]+)/?$ index2.php?page=$1 [L]
|
||||
RewriteRule ^index2/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index2.php?page=$1&$2=$3 [L]
|
||||
RewriteRule ^index2/([^/\.]+)/([^/\.]+)/?$ index2.php?page=$1§ion=$2 [L]
|
||||
RewriteRule ^index2/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index2.php?page=$1§ion=$2&$3=$4 [L]
|
||||
|
||||
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
|
||||
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?page=$1&$2=$3 [L]
|
||||
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1§ion=$2 [L]
|
||||
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?page=$1§ion=$2&$3=$4 [L]
|
||||
|
||||
|
||||
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
|
||||
Header set Cache-Control "max-age=290304000, public"
|
||||
</FilesMatch>
|
||||
|
||||
php_value post_max_size 100M
|
||||
|
||||
php_value max_input_vars 3000
|
||||
152
README.md
Normal file
152
README.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# Sistema de Ventas Avantika
|
||||
|
||||
## Descripción General
|
||||
Sistema integral de gestión de ventas, inventario y facturación multi-empresa desarrollado en PHP. Actualmente funciona con PHP heredado y requiere migración completa a PHP 8.
|
||||
|
||||
## Arquitectura del Sistema
|
||||
|
||||
### Multi-Empresa
|
||||
El sistema maneja múltiples empresas mediante una arquitectura de bases de datos separadas:
|
||||
|
||||
- **Base Master:** `avantikads_nmgen` - Autenticación y catálogos globales
|
||||
- **Bases Empresa:** `avantikads_nm{empresaId}` - Datos específicos por empresa
|
||||
- **Ejemplo:** `avantikads_nm15` para empresaId = 15
|
||||
|
||||
### Flujo de Autenticación
|
||||
1. Usuario inicia sesión → Conexión a base master
|
||||
2. Validación de credenciales en tabla `usuario`
|
||||
3. Obtención de `empresaId` del registro del usuario
|
||||
4. Conexión dinámica a base de datos específica de la empresa
|
||||
|
||||
## Estado Actual
|
||||
|
||||
### Versión PHP
|
||||
- **Actual:** PHP con funciones obsoletas (mysql_*)
|
||||
- **Requerido:** Migración completa a PHP 8
|
||||
|
||||
### Compatibilidad
|
||||
- **❌ NO COMPATIBLE** con PHP 8
|
||||
- **Requiere migración completa** antes de actualizar
|
||||
|
||||
## Problemas Críticos Identificados
|
||||
|
||||
### 1. Funciones Obsoletas (CRÍTICO)
|
||||
- **13 funciones mysql_*** en `classes/db.class.php`
|
||||
- **Impacto:** Sistema completo sin base de datos
|
||||
- **Solución:** Migración completa a MySQLi/PDO
|
||||
|
||||
### 2. Funciones Eliminadas en PHP 8
|
||||
- `ereg_replace()` → `preg_replace()`
|
||||
- `each()` → `foreach()` (7 archivos)
|
||||
- `create_function()` → funciones anónimas (4 archivos)
|
||||
- `split()` → `explode()`/`preg_split()` (4 archivos)
|
||||
|
||||
### 3. Sintaxis Incompatible
|
||||
- 100+ ocurrencias de `$string{index}` → `$string[index]`
|
||||
- 98+ asignaciones `list()` incorrectas
|
||||
- Múltiples asignaciones por referencia problemáticas
|
||||
|
||||
### 4. Seguridad
|
||||
- Credenciales de bases de datos en código fuente
|
||||
- Falta de configuración centralizada segura
|
||||
|
||||
## Estructura del Proyecto
|
||||
|
||||
```
|
||||
ventas/
|
||||
├── index.php # Punto de entrada principal
|
||||
├── config.php # Configuración actual (a eliminar)
|
||||
├── libraries.php # Carga de clases y librerías
|
||||
├── init.php # Inicialización del sistema
|
||||
├── classes/ # Clases del sistema
|
||||
│ ├── db.class.php # Base de datos (mysql_* obsoletas)
|
||||
│ ├── util.class.php # Utilidades (funciones obsoletas)
|
||||
│ ├── usuario.class.php # Gestión de usuarios
|
||||
│ ├── producto.class.php # Gestión de productos
|
||||
│ └── [20+ clases más]
|
||||
├── ajax/ # Endpoints AJAX (50+ archivos)
|
||||
├── modules/ # Módulos del sistema (100+ archivos)
|
||||
├── templates_c/ # Plantillas compiladas Smarty
|
||||
├── pdf/ # Generación de PDFs
|
||||
├── tcpdf/ # Librería TCPDF
|
||||
├── properties/ # Archivos de configuración
|
||||
├── base_datos/ # Esquemas de bases de datos
|
||||
│ ├── avantikads_nmgen.sql # Estructura base master
|
||||
│ └── avantikads_nm15.sql # Ejemplo empresa
|
||||
└── php8-migration/ # Plan de migración a PHP 8
|
||||
```
|
||||
|
||||
## Tecnologías Utilizadas
|
||||
|
||||
### Backend
|
||||
- **PHP** (versión heredada)
|
||||
- **MySQL** (multi-base de datos)
|
||||
- **Smarty** (motor de plantillas)
|
||||
- **NuSOAP** (webservices)
|
||||
- **PHPMailer** (correos electrónicos)
|
||||
- **TCPDF** (generación de PDFs)
|
||||
|
||||
### Base de Datos
|
||||
- **MySQL** con arquitectura multi-empresa
|
||||
- **Motor:** InnoDB/MyISAM mixto
|
||||
- **Charset:** latin1 (requiere migración a utf8mb4)
|
||||
|
||||
## Módulos Principales
|
||||
|
||||
- **Usuarios:** Gestión multi-empresa de usuarios
|
||||
- **Productos:** Catálogo y control de inventario
|
||||
- **Pedidos:** Sistema de pedidos y envíos
|
||||
- **Ventas:** Procesamiento de ventas y facturación
|
||||
- **Facturación:** Facturas electrónicas (México)
|
||||
- **Inventario:** Control y ajustes de inventario
|
||||
- **Reportes:** Múltiples reportes de negocio
|
||||
- **Proveedores:** Gestión de proveedores
|
||||
- **Clientes:** Administración de clientes
|
||||
|
||||
## Plan de Migración a PHP 8
|
||||
|
||||
### Documentación Completa
|
||||
Ver `php8-migration/` para documentación detallada:
|
||||
|
||||
1. **`analisis-sistema.md`** - Análisis general
|
||||
2. **`reporte-problemas.md`** - Problemas identificados
|
||||
3. **`plan-ejecucion.md`** - Plan de migración
|
||||
4. **`ejemplo-db-mysqli.php`** - Ejemplo migración DB
|
||||
5. **`ejemplo-env-config.php`** - Configuración segura
|
||||
6. **`.env.example`** - Plantilla de variables
|
||||
7. **`archivos-criticos.md`** - Lista de archivos críticos
|
||||
8. **`analisis-base-datos.md`** - Análisis BD multi-empresa
|
||||
|
||||
### Estimación de Tiempo
|
||||
- **Total estimado:** 113-162 horas
|
||||
- **Fases:** Configuración → MySQL → Funciones → Sintaxis → Pruebas
|
||||
|
||||
## Requisitos de Migración
|
||||
|
||||
### Críticos
|
||||
1. ✅ Migrar funciones mysql_* a MySQLi/PDO
|
||||
2. ✅ Implementar configuración .env segura
|
||||
3. ✅ Actualizar sintaxis PHP 8
|
||||
4. ✅ Reemplazar funciones obsoletas
|
||||
|
||||
### Seguridad
|
||||
1. ✅ Eliminar credenciales del código
|
||||
2. ✅ Implementar variables de entorno
|
||||
3. ✅ Validar routing multi-empresa
|
||||
4. ✅ Aislar datos por empresa
|
||||
|
||||
## Advertencias Importantes
|
||||
|
||||
⚠️ **NO ACTUALIZAR PHP** sin completar migración completa
|
||||
⚠️ **Backup completo** obligatorio antes de cambios
|
||||
⚠️ **Entorno de pruebas** aislado requerido
|
||||
⚠️ **Pérdida total de funcionalidad** si se actualiza PHP sin migración
|
||||
|
||||
## Licencia
|
||||
|
||||
Sistema propiedad de Avantika - Uso exclusivo del propietario.
|
||||
|
||||
---
|
||||
|
||||
**Última actualización:** Enero 2026
|
||||
**Estado:** En espera de aprobación para migración a PHP 8
|
||||
154
ajax/analisis-venta.php
Executable file
154
ajax/analisis-venta.php
Executable file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'loadAnalisis':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$fechaIni = trim($_POST['fechaI']);
|
||||
$fechaFin = trim($_POST['fechaF']);
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
|
||||
if($sucursalId)
|
||||
$sqlFilter = ' AND v.sucursalId = "'.$sucursalId.'" ';
|
||||
|
||||
if($Usr['type'] == 'supervisor')
|
||||
$sql = 'SELECT COUNT(v.ventaId) AS cantVtas, s.sucursalId, s.nombre
|
||||
FROM venta v, sucursal s, usuarioSuc us
|
||||
WHERE v.sucursalId = s.sucursalId
|
||||
AND s.sucursalId = us.sucursalId
|
||||
AND us.usuarioId = "'.$Usr['usuarioId'].'"
|
||||
AND DATE(v.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(v.fecha) <= "'.$fechaFin.'"
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
'.$sqlFilter.'
|
||||
GROUP BY sucursalId
|
||||
ORDER BY s.noSuc';
|
||||
else
|
||||
$sql = 'SELECT COUNT(v.ventaId) AS cantVtas, s.sucursalId, s.nombre
|
||||
FROM venta v, sucursal s
|
||||
WHERE v.sucursalId = s.sucursalId
|
||||
AND DATE(v.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(v.fecha) <= "'.$fechaFin.'"
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
'.$sqlFilter.'
|
||||
GROUP BY sucursalId
|
||||
ORDER BY s.noSuc';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resSucursales = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$totales = array();
|
||||
$sucursales = array();
|
||||
foreach($resSucursales as $res){
|
||||
|
||||
if($res['cantVtas'] == 0)
|
||||
continue;
|
||||
|
||||
$sql = 'SELECT p.proveedorId , prov.nombre
|
||||
FROM venta AS v, ventaProducto AS vp, producto AS p, proveedor AS prov
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND p.proveedorId = prov.proveedorId
|
||||
AND v.sucursalId = "'.$res['sucursalId'].'"
|
||||
AND DATE(v.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(v.fecha) <= "'.$fechaFin.'"
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
GROUP BY p.proveedorId
|
||||
ORDER BY prov.nombre ASC';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resProvs = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$proveedores = array();
|
||||
foreach($resProvs as $res2){
|
||||
|
||||
$sql = 'SELECT p.codigoBarra, p.modelo, vp.productoId, SUM(vp.cantidad) AS totProds,
|
||||
(SUM(vp.cantidad) * vp.precioUnitario) AS totVtas,
|
||||
(SUM(vp.cantidad) * (vp.precioUnitario - p.costo)) AS utilidad,
|
||||
(
|
||||
SELECT e.fechaRecibido
|
||||
FROM envio AS e, envioRecibir AS er
|
||||
WHERE e.envioId = er.envioId
|
||||
AND er.productoId = vp.productoId
|
||||
AND e.sucursalId = v.sucursalId
|
||||
ORDER BY e.fechaRecibido DESC
|
||||
LIMIT 1
|
||||
) AS fechaEnt
|
||||
FROM venta AS v, ventaProducto AS vp, producto AS p
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND v.sucursalId = "'.$res['sucursalId'].'"
|
||||
AND p.proveedorId = "'.$res2['proveedorId'].'"
|
||||
AND DATE(v.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(v.fecha) <= "'.$fechaFin.'"
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
GROUP BY vp.productoId';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$res2['productos'] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = 'SELECT SUM(vp.cantidad) AS totProds,
|
||||
SUM(vp.cantidad * vp.precioUnitario) AS totVtas,
|
||||
SUM(vp.cantidad * vp.precioUnitario - p.costo) AS utilidad
|
||||
FROM venta AS v, ventaProducto AS vp, producto AS p
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND v.sucursalId = "'.$res['sucursalId'].'"
|
||||
AND p.proveedorId = "'.$res2['proveedorId'].'"
|
||||
AND DATE(v.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(v.fecha) <= "'.$fechaFin.'"
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$res2['prendas'] = $row['totProds'];
|
||||
$res2['ventas'] = $row['totVtas'];
|
||||
$res2['utilidad'] = $row['utilidad'];
|
||||
|
||||
$totales['totProds'] += $row['totProds'];
|
||||
$totales['totVtas'] += $row['totVtas'];
|
||||
$totales['utilidad'] += $row['utilidad'];
|
||||
|
||||
$proveedores[] = $res2;
|
||||
|
||||
}//foreach resProvs
|
||||
$res['proveedores'] = $proveedores;
|
||||
|
||||
$res['nombre'] = urldecode($res['nombre']);
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('fechaIni',$fechaIni);
|
||||
$smarty->assign('fechaFin',$fechaFin);
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/analisis-venta.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
126
ajax/atributos-valores.php
Executable file
126
ajax/atributos-valores.php
Executable file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addValor':
|
||||
|
||||
$atributoId = $_POST['atributoId'];
|
||||
|
||||
$smarty->assign('atributoId',$atributoId);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-atributo-valor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveValor':
|
||||
|
||||
$atributoId = $_POST['atributoId'];
|
||||
|
||||
$atribVal->setAtributoId($atributoId);
|
||||
$atribVal->setNombre($_POST['name']);
|
||||
|
||||
if(!$atribVal->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
echo $atributoId;
|
||||
echo '[#]';
|
||||
|
||||
$atribVal->setAtributoId($atributoId);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$item['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos-valores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editValor':
|
||||
|
||||
$atribVal->setAtribValId($_POST['atribValId']);
|
||||
$info = $atribVal->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-atributo-valor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditValor':
|
||||
|
||||
$atribVal->setAtribValId($_POST['atribValId']);
|
||||
$atribVal->setNombre($_POST['name']);
|
||||
|
||||
$info = $atribVal->Info();
|
||||
$atributoId = $info['atributoId'];
|
||||
|
||||
if(!$atribVal->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
echo $atributoId;
|
||||
echo '[#]';
|
||||
|
||||
$atribVal->setAtributoId($atributoId);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$item['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos-valores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteValor':
|
||||
|
||||
$atribVal->setAtribValId($_POST['atribValId']);
|
||||
$info = $atribVal->Info();
|
||||
$atributoId = $info['atributoId'];
|
||||
|
||||
if(!$atribVal->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
echo $atributoId;
|
||||
echo '[#]';
|
||||
|
||||
$atribVal->setAtributoId($atributoId);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$item['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos-valores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
144
ajax/atributos.php
Executable file
144
ajax/atributos.php
Executable file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addAtributo':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-atributo-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAtributo':
|
||||
|
||||
$atributo->setNombre($_POST['name']);
|
||||
|
||||
if(!$atributo->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editAtributo':
|
||||
|
||||
$atributoId = $_POST['atributoId'];
|
||||
|
||||
$atributo->setAtributoId($atributoId);
|
||||
$info = $atributo->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-atributo-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditAtributo':
|
||||
|
||||
$atributo->setAtributoId($_POST['atributoId']);
|
||||
$atributo->setNombre($_POST['name']);
|
||||
|
||||
if(!$atributo->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteAtributo':
|
||||
|
||||
$atributoId = $_POST['atributoId'];
|
||||
|
||||
$atributo->setAtributoId($atributoId);
|
||||
|
||||
if(!$atributo->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
64
ajax/autoCompProd.php
Executable file
64
ajax/autoCompProd.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$criterio = strtolower(trim($_GET["term"]));
|
||||
if (!$criterio)
|
||||
return;
|
||||
|
||||
?>
|
||||
|
||||
[<?php
|
||||
|
||||
|
||||
$producto->setCodigoBarra($criterio);
|
||||
$products = $producto->SuggestVta();
|
||||
$resProds = $util->EncodeResult($products);
|
||||
|
||||
$contador = 0;
|
||||
foreach($resProds as $res){
|
||||
|
||||
$atribVal->setAtribValId($res['tallaId']);
|
||||
$res['talla'] = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($res['colorId']);
|
||||
$res['color'] = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$descripcion = $res['modelo'].' '.$res['talla'].' '.$res['color'];
|
||||
$descripcion2 = $res['codigoBarra'].' '.$res['modelo'].' '.$res['talla'].' '.$res['color'];
|
||||
|
||||
$valor = $res['prodItemId'];
|
||||
|
||||
$codigoBarra = $res['codigoBarra'];
|
||||
|
||||
if (strpos(strtolower($descripcion2), $criterio) !== false)
|
||||
{
|
||||
if ($contador++ > 0)
|
||||
print ", ";
|
||||
|
||||
print "{ \"label\" : \"$descripcion\", \"value\" : { \"descripcion\" : \"$descripcion\", \"prodItemId\" : \"$valor\", \"codigoBarra\" : \"$codigoBarra\" } }";
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
$monederos = $monedero->SuggestVta();
|
||||
|
||||
foreach($monederos as $res){
|
||||
|
||||
$descripcion = 'Tarjeta de Prepago de '.$res['saldo'];
|
||||
$codigoBarra = $res['codigo'];
|
||||
$valor = $res['monederoId'];
|
||||
|
||||
if (strpos(strtolower($codigoBarra.' '.$descripcion), $criterio) !== false)
|
||||
{
|
||||
if ($contador++ > 0)
|
||||
print ", ";
|
||||
|
||||
print "{ \"label\" : \"$descripcion\", \"value\" : { \"descripcion\" : \"$descripcion\", \"prodItemId\" : \"$valor\", \"codigoBarra\" : \"$codigoBarra\", \"tipo\" : \"Tarjeta\"} }";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>]
|
||||
261
ajax/bonificaciones-agregar.php
Executable file
261
ajax/bonificaciones-agregar.php
Executable file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'buscarFactura':
|
||||
|
||||
$bonificacion->setFolioProv($_POST['folioProv']);
|
||||
$infP = $bonificacion->GetPedidoByFolio();
|
||||
|
||||
if(!$infP){
|
||||
$util->setError(20144,'complete','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$nomProv = $proveedor->GetNameById();
|
||||
|
||||
$fecha = date('d-m-Y H:i:s',strtotime($infP['fecha']));
|
||||
$fechaRecibido = date('d-m-Y H:i:s',strtotime($infP['fechaOrdenCompIng']));
|
||||
|
||||
$fechaRec = strtotime($infP['fechaOrdenCompIng']);
|
||||
$fechaHoy = time();
|
||||
|
||||
$timeDias = $fechaHoy - $fechaRec;
|
||||
|
||||
$diasTrans = intval($timeDias / 86400);
|
||||
|
||||
if($infP['status'] == 'OrdenCompIng')
|
||||
$status = 'Mercancía Recibida en CEDIS';
|
||||
elseif($infP['status'] == 'EnvSuc')
|
||||
$status = 'Envíado a Tiendas';
|
||||
|
||||
//Obtenemos los Productos
|
||||
|
||||
$bonificacion->setPedidoId($infP['pedidoId']);
|
||||
$resProductos = $bonificacion->EnumProdsByPedido();
|
||||
|
||||
$productos = array();
|
||||
foreach($resProductos as $res){
|
||||
|
||||
$productoId = $res['productoId'];
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infProd = $producto->Info();
|
||||
|
||||
$res['codigoBarra'] = $infProd['codigoBarra'];
|
||||
|
||||
$res['precio'] = $infProd['precioVentaIva'];
|
||||
$res['totalCosto'] = $res['costo'] * $res['cantPrendas'];
|
||||
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['cantVenta'] = $bonificacion->CantVtasByProd();
|
||||
|
||||
$res['cantCompra'] = $res['cantPrendas'];
|
||||
|
||||
$res['porc'] = round(($res['cantVenta'] / $res['cantCompra']) * 100);
|
||||
|
||||
$res['totalVenta'] = $res['cantVenta'] * $infProd['precioVentaIva'];
|
||||
|
||||
if($res['totalVenta'])
|
||||
$res['utilidad'] = round((($res['totalVenta'] - $res['totalCosto']) / $res['totalVenta']) * 100);
|
||||
else
|
||||
$res['utilidad'] = 0;
|
||||
|
||||
$res['precioVta'] = $infProd['precioVenta'];
|
||||
|
||||
if($res['porc'] < 35){
|
||||
|
||||
$res['devolucion'] = 'DEV';
|
||||
$res['cantDev'] = $res['cantCompra'] - $res['cantVenta'];
|
||||
$res['totalDev'] = $res['cantDev'] * $res['costo'];
|
||||
|
||||
}else{
|
||||
|
||||
$res['devolucion'] = '---';
|
||||
$res['cantDev'] = 0;
|
||||
$res['totalDev'] = 0;
|
||||
$res['porcBonif'] = 0;
|
||||
|
||||
$bonificacion->setPorcentaje($res['porc']);
|
||||
$res['porcBonif'] = $bonificacion->GetPorcBonif();
|
||||
|
||||
}
|
||||
|
||||
$res['totalBonif'] = ($res['cantCompra'] - $res['cantVenta']) * ($res['porcBonif'] / 100) * $res['costo'];
|
||||
$res['totalBonif'] = number_format($res['totalBonif'],2,'.','');
|
||||
|
||||
$productos[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $infP['pedidoId'];
|
||||
echo '[#]';
|
||||
echo $nomProv;
|
||||
echo '[#]';
|
||||
echo '<a href="'.WEB_ROOT.'/pedidos-detalles/id/'.$infP['pedidoId'].'" target="_blank">'.$infP['noPedido'].'</a>';
|
||||
echo '[#]';
|
||||
echo $status;
|
||||
echo '[#]';
|
||||
echo $fecha;
|
||||
echo '[#]';
|
||||
echo $fechaRecibido;
|
||||
echo '[#]';
|
||||
echo $diasTrans;
|
||||
|
||||
echo '[#]';
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/evaluacion-productos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'aplicarEval';
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$productoId = $_POST['productoId'];
|
||||
|
||||
//Obtenemos los Productos
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$resProductos = $bonificacion->EnumProdsByPedido();
|
||||
|
||||
$productos = array();
|
||||
foreach($resProductos as $res){
|
||||
|
||||
$productoId = $res['productoId'];
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infProd = $producto->Info();
|
||||
|
||||
$res['codigoBarra'] = $infProd['codigoBarra'];
|
||||
|
||||
$res['precio'] = $infProd['precioVentaIva'];
|
||||
$res['totalCosto'] = $res['costo'] * $res['cantPrendas'];
|
||||
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['cantVenta'] = $bonificacion->CantVtasByProd();
|
||||
|
||||
$res['cantCompra'] = $res['cantPrendas'];
|
||||
|
||||
$res['porc'] = round(($res['cantVenta'] / $res['cantCompra']) * 100);
|
||||
|
||||
$res['totalVenta'] = $res['cantVenta'] * $infProd['precioVentaIva'];
|
||||
|
||||
if($res['totalVenta'])
|
||||
$res['utilidad'] = round((($res['totalVenta'] - $res['totalCosto']) / $res['totalVenta']) * 100);
|
||||
else
|
||||
$res['utilidad'] = 0;
|
||||
|
||||
$res['precioVta'] = $infProd['precioVenta'];
|
||||
|
||||
if($res['porc'] < 35){
|
||||
|
||||
$res['devolucion'] = 'DEV';
|
||||
$res['cantDev'] = $res['cantCompra'] - $res['cantVenta'];
|
||||
$res['totalDev'] = $res['cantDev'] * $res['costo'];
|
||||
$tipo = 'Dev';
|
||||
|
||||
}else{
|
||||
|
||||
$res['devolucion'] = '---';
|
||||
$res['cantDev'] = 0;
|
||||
$res['totalDev'] = 0;
|
||||
$res['porcBonif'] = 0;
|
||||
$tipo = 'Bonif';
|
||||
|
||||
$bonificacion->setPorcentaje($res['porc']);
|
||||
$res['porcBonif'] = $bonificacion->GetPorcBonif();
|
||||
|
||||
}
|
||||
|
||||
$res['totalBonif'] = ($res['cantCompra'] - $res['cantVenta']) * ($res['porcBonif'] / 100) * $res['costo'];
|
||||
$res['totalBonif'] = number_format($res['totalBonif'],2,'.','');
|
||||
|
||||
}//foreach
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$info = $producto->Info();
|
||||
|
||||
$sql = 'INSERT INTO bonifDev (pedidoId, productoId, fecha, porcBonif, totalBonif, costo, precioVentaIva,
|
||||
usuarioId, tipo, cantDev)
|
||||
VALUES ("'.$pedidoId.'", "'.$productoId.'", "'.date('Y-m-d H:i:s').'", "'.$res['porcBonif'].'",
|
||||
"'.$res['totalBonif'].'","'.$info['costo'].'","'.$info['precioVentaIva'].'",
|
||||
"'.$Usr['usuarioId'].'", "'.$tipo.'", "'.$res['cantDev'].'")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'UPDATE pedidoProducto SET evaluado = "1"
|
||||
WHERE pedidoId = "'.$pedidoId.'"
|
||||
AND productoId = "'.$productoId.'"';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
//Agegamos la bonificación al pedido
|
||||
|
||||
$totalDesc = $res['totalDesc'] - $res['totalBonif'];
|
||||
|
||||
$sql = 'UPDATE pedido SET totalBonif = totalBonif + "'.$res['totalBonif'].'", totalDesc = "'.$totalDesc.'"
|
||||
WHERE pedidoId = "'.$pedidoId.'"';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
if($tipo == 'Bonif'){
|
||||
|
||||
//Obtenemos el nuevo precio de venta.
|
||||
|
||||
$nvoPrecioVtaIva = $info['precioVentaIva'] - ($info['precioVentaIva'] * ($res['porcBonif'] / 100));
|
||||
$nvoPrecioVta = $info['precioVenta'] - ($info['precioVenta'] * ($res['porcBonif'] / 100));
|
||||
$nuevoCosto = $info['costo']-($info['costo'] * ($res['porcBonif'] / 100));
|
||||
|
||||
//Actualizamos Inventario
|
||||
$sql = "UPDATE inventario SET rebajado = '1', precioVenta = ".$nvoPrecioVtaIva."
|
||||
WHERE pedidoId = ".$pedidoId."
|
||||
AND productoId = ".$productoId."
|
||||
AND `status` LIKE 'Disponible'";
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
//Actualizamos el Costo del Producto.
|
||||
$sql = "UPDATE producto SET costo = '".$nuevoCosto."',
|
||||
precioVenta = '".$nvoPrecioVta."',
|
||||
precioVentaIva = '".$nvoPrecioVtaIva."'
|
||||
WHERE productoId = ".$productoId;
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
}else{
|
||||
|
||||
//Bloqueamos los productos en Inventario
|
||||
$sql = "UPDATE inventario SET status = 'Devolucion'
|
||||
WHERE pedidoId = ".$pedidoId."
|
||||
AND productoId = ".$productoId."
|
||||
AND status = 'Disponible'";
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
}//if
|
||||
|
||||
$util->setError(20143,'complete','');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
85
ajax/centralizador.php
Executable file
85
ajax/centralizador.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'searchVentas':
|
||||
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
$usuarioId = $_POST['usuarioId2'];
|
||||
$fechaIni = $_POST['fechaIni2'];
|
||||
$fechaFin = $_POST['fechaFin2'];
|
||||
|
||||
if($sucursalId == ''){
|
||||
$util->setError(20084,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaIni == ''){
|
||||
$util->setError(20114,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaFin == ''){
|
||||
$util->setError(20115,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$venta->setSucursalId($sucursalId);
|
||||
$venta->setUsuarioId($usuarioId);
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
$ventas = $venta->SearchCentral($fechaIni, $fechaFin);
|
||||
|
||||
$items = array();
|
||||
foreach($ventas['items'] as $res){
|
||||
|
||||
$fecha = date('d-m-Y',strtotime($res['fecha']));
|
||||
$hora = date('H:i:s',strtotime($res['fecha']));
|
||||
$fecha = $util->FormatDateDMMMY($fecha);
|
||||
$res['fecha'] = $fecha.' '.$hora;
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetNameById();
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($res['totalDesc'] > 0)
|
||||
$res['total'] = $res['totalDesc'];
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$ventas['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('ventas', $ventas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/ventas.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
190
ajax/clientes.php
Executable file
190
ajax/clientes.php
Executable file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "addCliente":
|
||||
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-cliente-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveCliente":
|
||||
|
||||
$cliente->setRfc($_POST["rfc"]);
|
||||
$cliente->setRazonSocial(utf8_decode($_POST["razonSocial"]));
|
||||
$cliente->setCalle(utf8_decode($_POST["calle"]));
|
||||
$cliente->setNoExt(utf8_decode($_POST["noExt"]));
|
||||
$cliente->setNoInt(utf8_decode($_POST["noInt"]));
|
||||
$cliente->setReferencia(utf8_decode($_POST["referencia"]));
|
||||
$cliente->setColonia(utf8_decode($_POST["colonia"]));
|
||||
$cliente->setLocalidad(utf8_decode($_POST["localidad"]));
|
||||
$cliente->setMunicipio(utf8_decode($_POST["municipio"]));
|
||||
$cliente->setCodigoPostal(utf8_decode($_POST["cp"]));
|
||||
$cliente->setEstado(utf8_decode($_POST["estado"]));
|
||||
$cliente->setPais(utf8_decode($_POST["pais"]));
|
||||
$cliente->setTelefono(utf8_decode($_POST["telefono"]));
|
||||
$cliente->setEmail($_POST["email"]);
|
||||
$cliente->setPassword($_POST["password"]);
|
||||
|
||||
if(!$cliente->Save())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo "[#]";
|
||||
$clientes = $cliente->Enumerate();
|
||||
$clientes['items'] = $util->EncodeResult($clientes['items']);
|
||||
|
||||
$smarty->assign("clientes", $clientes);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/clientes.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editCliente":
|
||||
|
||||
$cliente->setClienteId($_POST['id']);
|
||||
$info = $cliente->Info();
|
||||
$info = $util->EncodeRow($info);
|
||||
|
||||
$smarty->assign("post", $info);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-cliente-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveEditCliente":
|
||||
|
||||
$cliente->setClienteId($_POST['clienteId']);
|
||||
$cliente->setRfc($_POST["rfc"]);
|
||||
$cliente->setRazonSocial(utf8_decode($_POST["razonSocial"]));
|
||||
$cliente->setCalle(utf8_decode($_POST["calle"]));
|
||||
$cliente->setNoExt(utf8_decode($_POST["noExt"]));
|
||||
$cliente->setNoInt(utf8_decode($_POST["noInt"]));
|
||||
$cliente->setReferencia(utf8_decode($_POST["referencia"]));
|
||||
$cliente->setColonia(utf8_decode($_POST["colonia"]));
|
||||
$cliente->setLocalidad(utf8_decode($_POST["localidad"]));
|
||||
$cliente->setMunicipio(utf8_decode($_POST["municipio"]));
|
||||
$cliente->setCodigoPostal(utf8_decode($_POST["cp"]));
|
||||
$cliente->setEstado(utf8_decode($_POST["estado"]));
|
||||
$cliente->setPais(utf8_decode($_POST["pais"]));
|
||||
$cliente->setTelefono(utf8_decode($_POST["telefono"]));
|
||||
$cliente->setEmail($_POST["email"]);
|
||||
$cliente->setPassword($_POST["password"]);
|
||||
|
||||
if(!$cliente->Update())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo "[#]";
|
||||
$clientes = $cliente->Enumerate();
|
||||
$clientes['items'] = $util->EncodeResult($clientes['items']);
|
||||
|
||||
$smarty->assign("clientes", $clientes);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/clientes.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "viewCliente":
|
||||
|
||||
$cliente->setClienteId($_POST['id']);
|
||||
$info = $cliente->Info();
|
||||
$info = $util->EncodeRow($info);
|
||||
|
||||
$smarty->assign("post", $info);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/detalles-cliente-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "deleteCliente":
|
||||
|
||||
$cliente->setClienteId($_POST['id']);
|
||||
|
||||
if($cliente->Baja())
|
||||
{
|
||||
echo "Ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$clientes = $cliente->Enumerate();
|
||||
$clientes['items'] = $util->EncodeResult($clientes['items']);
|
||||
|
||||
$smarty->assign("clientes", $clientes);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/clientes.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "search":
|
||||
|
||||
$cliente->setNombre($_POST['word']);
|
||||
$clientes = $cliente->Search();
|
||||
$clientes['items'] = $util->EncodeResult($clientes['items']);
|
||||
|
||||
$smarty->assign("clientes", $clientes);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/clientes.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'fillInfoClte':
|
||||
|
||||
$cliente->setClienteId($_POST['clienteId']);
|
||||
$info = $cliente->Info();
|
||||
$info = $util->EncodeRow($info);
|
||||
|
||||
echo 'ok';
|
||||
echo '[#]';
|
||||
echo $info['clienteId'];
|
||||
echo '[#]';
|
||||
echo $info['rfc'];
|
||||
echo '[#]';
|
||||
echo $info['nombre'];
|
||||
echo '[#]';
|
||||
echo $info['calle'];
|
||||
echo '[#]';
|
||||
echo $info['noExt'];
|
||||
echo '[#]';
|
||||
echo $info['noInt'];
|
||||
echo '[#]';
|
||||
echo $info['colonia'];
|
||||
echo '[#]';
|
||||
echo $info['municipio'];
|
||||
echo '[#]';
|
||||
echo $info['cp'];
|
||||
echo '[#]';
|
||||
echo $info['estado'];
|
||||
echo '[#]';
|
||||
echo $info['localidad'];
|
||||
echo '[#]';
|
||||
echo $info['pais'];
|
||||
echo '[#]';
|
||||
echo $info['referencia'];
|
||||
echo '[#]';
|
||||
echo $info['email'];
|
||||
echo '[#]';
|
||||
echo $info['pais'];
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
96
ajax/colores.php
Executable file
96
ajax/colores.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'addColor':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-color-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddColor':
|
||||
|
||||
$color->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$color->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$colores = $color->Enumerate();
|
||||
$colores['items'] = $util->EncodeResult($colores['items']);
|
||||
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/colores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editColor':
|
||||
|
||||
$color->setColorId($_POST['id']);
|
||||
$info = $color->Info();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-color-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditColor':
|
||||
|
||||
$color->setColorId($_POST['colorId']);
|
||||
$color->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$color->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$colores = $color->Enumerate();
|
||||
$colores['items'] = $util->EncodeResult($colores['items']);
|
||||
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/colores.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deleteColor':
|
||||
|
||||
$color->setColorId($_POST['id']);
|
||||
|
||||
if($color->Delete())
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$colores = $color->Enumerate();
|
||||
$colores['items'] = $util->EncodeResult($colores['items']);
|
||||
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/colores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
113
ajax/comisiones.php
Executable file
113
ajax/comisiones.php
Executable file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addComision':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-comision-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveComision':
|
||||
|
||||
$comision->setTipoUsuario($_POST['tipo']);
|
||||
$comision->setComisionBajo($_POST['comisionBajo']);
|
||||
$comision->setComisionAlto($_POST['comisionAlto']);
|
||||
$comision->setRango($_POST['rango']);
|
||||
|
||||
if(!$comision->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
$comisiones = $comision->Enumerate();
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
foreach($comisiones['items'] as $key => $resComision)
|
||||
{
|
||||
$comisiones['items'][$key]['tipoUsuario'] = $util->GetNameUsrType($resComision['tipoUsuario']);
|
||||
}
|
||||
$smarty->assign('comisiones', $comisiones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/comisiones.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editComision':
|
||||
|
||||
$comisionId = $_POST['comisionId'];
|
||||
|
||||
$comision->setComisionId($comisionId);
|
||||
$info = $comision->Info();
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-comision-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditComision':
|
||||
|
||||
$comision->setComisionId($_POST['comisionId']);
|
||||
$comision->setTipoUsuario($_POST['tipo']);
|
||||
$comision->setComisionBajo($_POST['comisionBajo']);
|
||||
$comision->setComisionAlto($_POST['comisionAlto']);
|
||||
$comision->setRango($_POST['rango']);
|
||||
|
||||
if(!$comision->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
$comisiones = $comision->Enumerate();
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
foreach($comisiones['items'] as $key => $resComision)
|
||||
{
|
||||
$comisiones['items'][$key]['tipoUsuario'] = $util->GetNameUsrType($resComision['tipoUsuario']);
|
||||
}
|
||||
$smarty->assign('comisiones', $comisiones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/comisiones.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deleteComision':
|
||||
|
||||
$comisionId = $_POST['comisionId'];
|
||||
|
||||
$comision->setComisionId($comisionId);
|
||||
|
||||
if(!$comision->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$comisiones = $comision->Enumerate();
|
||||
foreach($comisiones['items'] as $key => $resComision)
|
||||
{
|
||||
$comisiones['items'][$key]['tipoUsuario'] = $util->GetNameUsrType($resComision['tipoUsuario']);
|
||||
}
|
||||
$smarty->assign('comisiones', $comisiones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/comisiones.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
229
ajax/conjunto-tallas.php
Executable file
229
ajax/conjunto-tallas.php
Executable file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addConjunto':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-conjunto-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveConjunto':
|
||||
|
||||
$conTalla->setNombre($_POST['name']);
|
||||
|
||||
if(count($_POST['tallaIds']) == 0)
|
||||
$_POST['tallaIds'] = array();
|
||||
|
||||
$tallas = array();
|
||||
foreach($_POST['tallaIds'] as $tallaId){
|
||||
if($tallaId)
|
||||
$tallas[] = $tallaId;
|
||||
}
|
||||
|
||||
$conTallaId = $conTalla->Save();
|
||||
|
||||
if(!$conTallaId)
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
//Guardamos las Tallas
|
||||
|
||||
foreach($tallas as $tallaId){
|
||||
|
||||
$conValor->setConTallaId($conTallaId);
|
||||
$conValor->setTallaId($tallaId);
|
||||
$conValor->Save();
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$conjuntos = $conTalla->Enumerate();
|
||||
$conjuntos["items"] = $util->EncodeResult($conjuntos["items"]);
|
||||
|
||||
$smarty->assign('conjuntos', $conjuntos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conjunto-tallas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editConjunto':
|
||||
|
||||
$conTallaId = $_POST['conTallaId'];
|
||||
|
||||
$conTalla->setConTallaId($conTallaId);
|
||||
$info = $conTalla->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$conValor->setConTallaId($conTallaId);
|
||||
$conTallas = $conValor->EnumerateAll();
|
||||
|
||||
$_SESSION['conTallas'] = $conTallas;
|
||||
|
||||
$atribVal->setAtributoId(1);
|
||||
$tallas = $atribVal->EnumerateAll();
|
||||
$tallas = $util->EncodeResult($tallas);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('conTallas', $conTallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-conjunto-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditConjunto':
|
||||
|
||||
$conTallaId = $_POST['conTallaId'];
|
||||
|
||||
$conTalla->setConTallaId($_POST['conTallaId']);
|
||||
$conTalla->setNombre($_POST['name']);
|
||||
|
||||
$tallas = array();
|
||||
foreach($_POST['tallaIds'] as $tallaId){
|
||||
if($tallaId)
|
||||
$tallas[] = $tallaId;
|
||||
}
|
||||
|
||||
if(!$conTalla->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
//Eliminamos las Tallas
|
||||
|
||||
$conValor->setConTallaId($conTallaId);
|
||||
$conValor->DeleteAll();
|
||||
|
||||
//Guardamos las Tallas
|
||||
|
||||
foreach($tallas as $tallaId){
|
||||
|
||||
$conValor->setConTallaId($conTallaId);
|
||||
$conValor->setTallaId($tallaId);
|
||||
$conValor->Save();
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$conjuntos = $conTalla->Enumerate();
|
||||
$conjuntos["items"] = $util->EncodeResult($conjuntos["items"]);
|
||||
|
||||
$smarty->assign('conjuntos', $conjuntos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conjunto-tallas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteConjunto':
|
||||
|
||||
$conTallaId = $_POST['conTallaId'];
|
||||
|
||||
$conTalla->setConTallaId($conTallaId);
|
||||
|
||||
if(!$conTalla->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$conjuntos = $conTalla->Enumerate();
|
||||
$conjuntos["items"] = $util->EncodeResult($conjuntos["items"]);
|
||||
|
||||
$smarty->assign('conjuntos', $conjuntos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conjunto-tallas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*** TALLAS ***/
|
||||
|
||||
case 'addTalla':
|
||||
|
||||
$conTallas = $_SESSION['conTallas'];
|
||||
|
||||
$card['tallaId'] = '';
|
||||
|
||||
$conTallas[] = $card;
|
||||
|
||||
$_SESSION['conTallas'] = $conTallas;
|
||||
|
||||
$atribVal->setAtributoId(1);
|
||||
$tallas = $atribVal->EnumerateAll();
|
||||
$tallas = $util->EncodeResult($tallas);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('conTallas', $conTallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conjunto-valores.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'delTalla':
|
||||
|
||||
$k = $_POST['k'];
|
||||
|
||||
$conTallas = $_SESSION['conTallas'];
|
||||
|
||||
unset($conTallas[$k]);
|
||||
|
||||
$_SESSION['conTallas'] = $conTallas;
|
||||
|
||||
$atribVal->setAtributoId(1);
|
||||
$tallas = $atribVal->EnumerateAll();
|
||||
$tallas = $util->EncodeResult($tallas);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('conTallas', $conTallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conjunto-valores.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveTallas':
|
||||
|
||||
$tallaIds = $_POST['tallaIds'];
|
||||
|
||||
if(!count($tallaIds))
|
||||
$tallaIds = array();
|
||||
|
||||
$tallas = array();
|
||||
foreach($tallaIds as $k => $val){
|
||||
$card['tallaId'] = $val;
|
||||
|
||||
$tallas[$k] = $card;
|
||||
}
|
||||
|
||||
$_SESSION['conTallas'] = $tallas;
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
117
ajax/cuentas-bancarias.php
Executable file
117
ajax/cuentas-bancarias.php
Executable file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'addCuentaBancaria':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-cuenta-bancaria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddCuentaBancaria':
|
||||
|
||||
$cuentaBancaria->setBanco($_POST['banco']);
|
||||
$cuentaBancaria->setNoCuenta($_POST['noCuenta']);
|
||||
$cuentaBancaria->setSucursal($_POST['sucursal']);
|
||||
$cuentaBancaria->setTitular($_POST['titular']);
|
||||
$cuentaBancaria->setClabe($_POST['clabe']);
|
||||
|
||||
if(!$cuentaBancaria->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$cuentasBancarias = $cuentaBancaria->Enumerate();
|
||||
$cuentasBancarias['items'] = $util->EncodeResult($cuentasBancarias['items']);
|
||||
|
||||
$smarty->assign('cuentasBancarias', $cuentasBancarias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-bancarias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editCuentaBancaria':
|
||||
|
||||
$cuentaBancaria->setCuentaBancariaId($_POST['id']);
|
||||
$info = $cuentaBancaria->Info();
|
||||
$info = $util->EncodeRow($info);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-cuenta-bancaria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditCuentaBancaria':
|
||||
|
||||
$cuentaBancaria->setCuentaBancariaId($_POST['cuentaBancariaId']);
|
||||
$cuentaBancaria->setBanco($_POST['banco']);
|
||||
$cuentaBancaria->setNoCuenta($_POST['noCuenta']);
|
||||
$cuentaBancaria->setSucursal($_POST['sucursal']);
|
||||
$cuentaBancaria->setTitular($_POST['titular']);
|
||||
$cuentaBancaria->setClabe($_POST['clabe']);
|
||||
|
||||
if(!$cuentaBancaria->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$cuentasBancarias = $cuentaBancaria->Enumerate();
|
||||
$cuentasBancarias['items'] = $util->EncodeResult($cuentasBancarias['items']);
|
||||
|
||||
$smarty->assign('cuentasBancarias', $cuentasBancarias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-bancarias.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'viewCuentaBancaria':
|
||||
|
||||
$cuentaBancaria->setCuentaBancariaId($_POST['id']);
|
||||
$info = $cuentaBancaria->Info();
|
||||
$info = $util->EncodeRow($info);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/detalles-cuenta-bancaria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteCuentaBancaria':
|
||||
|
||||
$cuentaBancaria->setCuentaBancariaId($_POST['id']);
|
||||
|
||||
if($cuentaBancaria->Baja())
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$cuentasBancarias = $cuentaBancaria->Enumerate();
|
||||
$cuentasBancarias['items'] = $util->EncodeResult($cuentasBancarias['items']);
|
||||
|
||||
$smarty->assign('cuentasBancarias', $cuentasBancarias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-bancarias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
288
ajax/cuentas-pagar-saldos.php
Executable file
288
ajax/cuentas-pagar-saldos.php
Executable file
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'editSaldoCtaPagar':
|
||||
|
||||
$proveedor->setProveedorId($_POST['id']);
|
||||
$infP = $proveedor->Info();
|
||||
$infP = $util->EncodeRow($infP);
|
||||
|
||||
$smarty->assign('post', $infP);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-proveedor-ctapagar-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveSaldoCtaPagar':
|
||||
|
||||
$proveedor->setProveedorId($_POST['proveedorId']);
|
||||
$proveedor->setSaldo($_POST['saldo']);
|
||||
|
||||
if(!$proveedor->UpdateSaldoCtaPagar())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$proveedores = $proveedor->Enumerate();
|
||||
$proveedores['items'] = $util->EncodeResult($proveedores['items']);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar-saldos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//PAGOS
|
||||
|
||||
case 'addPago':
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$infP = $proveedor->Info();
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setProveedorId($proveedorId);
|
||||
$abonos = $cuentaPagar->GetTotalPagosProv();
|
||||
|
||||
$info['saldo'] = $infP['saldoCtaPagar'] - $abonos;
|
||||
|
||||
$metodosPago = $metodoPago->EnumerateAll();
|
||||
$metodosPago = $util->EncodeResult($metodosPago);
|
||||
|
||||
$info['proveedorId'] = $proveedorId;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('metodosPago', $metodosPago);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-pago-prov-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddPago':
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
$metodoPagoId = $_POST['metodoPagoId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$noCheque = $_POST['noCheque'];
|
||||
$fecha = ($_POST['fecha'] != '') ? date('Y-m-d',strtotime($_POST['fecha'])) : '';
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$infP = $proveedor->Info();
|
||||
|
||||
$cuentaPagar->setProveedorId($proveedorId);
|
||||
$cuentaPagar->setMetodoPagoId($metodoPagoId);
|
||||
$cuentaPagar->setCantidad($cantidad);
|
||||
$cuentaPagar->setFecha($fecha);
|
||||
$cuentaPagar->setNoCheque($noCheque);
|
||||
$cuentaPagar->setNoFactura($_POST['noFactura']);
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$abonos = $cuentaPagar->GetTotalPagosProv();
|
||||
$saldo = $infP['saldoCtaPagar'] - $abonos;
|
||||
|
||||
$abonos = number_format($abonos,2,'.','');
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
if($cantidad > $saldo){
|
||||
$util->setError(20075, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$cuentaPagar->SavePagoProv())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Checamos si ya esta pagado totalmente
|
||||
$abonos = $cuentaPagar->GetTotalPagosProv();
|
||||
$saldo = $infP['saldoCtaPagar'] - $abonos;
|
||||
$pagado = ($saldo == 0) ? 1:0;
|
||||
|
||||
//Actualizamos el status a Pagado
|
||||
if($pagado){
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$proveedor->setPagado(1);
|
||||
$proveedor->UpdatePagado();
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $proveedorId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($abonos,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
echo $pagado;
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
|
||||
$cuentaPagar->setProveedorId($proveedorId);
|
||||
$resPagos = $cuentaPagar->EnumPagosProv();
|
||||
|
||||
$pagos = array();
|
||||
foreach($resPagos as $val){
|
||||
|
||||
$metodoPago->setMetodoPagoId($val['metodoPagoId']);
|
||||
$val['metodoPago'] = utf8_encode($metodoPago->GetNameById());
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$pagos[] = $val;
|
||||
}
|
||||
$item['pagos'] = $pagos;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagos-prov.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deletePago':
|
||||
|
||||
$provPagoId = $_POST['id'];
|
||||
|
||||
$cuentaPagar->setProvPagoId($provPagoId);
|
||||
$infP = $cuentaPagar->InfoPagoProv();
|
||||
|
||||
$proveedorId = $infP['proveedorId'];
|
||||
|
||||
if(!$cuentaPagar->DeletePagoProv())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$info = $proveedor->Info();
|
||||
|
||||
//Quitamos el status de Pagado
|
||||
$proveedor->setPagado(0);
|
||||
$proveedor->UpdatePagado();
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setProveedorId($proveedorId);
|
||||
$abonos = $cuentaPagar->GetTotalPagosProv();
|
||||
|
||||
$saldo = $info['saldoCtaPagar'] - $abonos;
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $proveedorId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($abonos,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
$cuentaPagar->setProveedorId($proveedorId);
|
||||
$resPagos = $cuentaPagar->EnumPagosProv();
|
||||
|
||||
$pagos = array();
|
||||
foreach($resPagos as $val){
|
||||
|
||||
$metodoPago->setMetodoPagoId($val['metodoPagoId']);
|
||||
$val['metodoPago'] = utf8_encode($metodoPago->GetNameById());
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$pagos[] = $val;
|
||||
}
|
||||
$item['pagos'] = $pagos;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagos-prov.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//OTHERS
|
||||
|
||||
case 'search':
|
||||
|
||||
$proveedor->setProveedorId($_POST['proveedorId2']);
|
||||
|
||||
$result = $proveedor->SearchSaldos($_POST['saldoIni2']);
|
||||
|
||||
$resProv = array();
|
||||
if(count($result))
|
||||
$resProv = $util->EncodeResult($result);
|
||||
|
||||
$total = 0;
|
||||
$totalAbonos = 0;
|
||||
$totalSaldoActual = 0;
|
||||
$items = array();
|
||||
foreach($resProv as $res){
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setProveedorId($res['proveedorId']);
|
||||
$res['abonos'] = $cuentaPagar->GetTotalPagosProv();
|
||||
|
||||
$res['saldoActual'] = $res['saldoCtaPagar'] - $res['abonos'];
|
||||
|
||||
$cuentaPagar->setProveedorId($res['proveedorId']);
|
||||
$resPagos = $cuentaPagar->EnumPagosProv();
|
||||
|
||||
$pagos = array();
|
||||
foreach($resPagos as $val){
|
||||
|
||||
$metodoPago->setMetodoPagoId($val['metodoPagoId']);
|
||||
$val['metodoPago'] = $metodoPago->GetNameById();
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$pagos[] = $val;
|
||||
}
|
||||
$res['pagos'] = $pagos;
|
||||
|
||||
$total += $res['saldoCtaPagar'];
|
||||
$totalAbonos += $res['abonos'];
|
||||
$totalSaldoActual += $res['saldoActual'];
|
||||
$items[] = $res;
|
||||
}
|
||||
|
||||
$proveedores['items'] = $items;
|
||||
|
||||
$smarty->assign('tipo', 'search');
|
||||
$smarty->assign('total', $total);
|
||||
$smarty->assign('totalAbonos', $totalAbonos);
|
||||
$smarty->assign('totalSaldoActual', $totalSaldoActual);
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar-saldos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
620
ajax/cuentas-pagar.php
Executable file
620
ajax/cuentas-pagar.php
Executable file
@@ -0,0 +1,620 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
$p = $_SESSION['edpP'];
|
||||
$projectId = $_SESSION['curProjId'];
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'viewDescuentos':
|
||||
|
||||
$value = split("#",$_POST['value']);
|
||||
|
||||
$proveedorId = $value[0];
|
||||
$pedidoId = $value[1];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentasPago = $cuentaPagar->EnumerateById();
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$descuentos = $proveedor->GetDescuentos();
|
||||
$nombreProveedor = $proveedor->GetNameById();
|
||||
|
||||
$totalPublicidad = ($cuentasPago['total']*$descuentos['publicidad'])/100;
|
||||
$totalFlete = ($cuentasPago['total']*$descuentos['flete'])/100;
|
||||
$totalDesarrollo = ($cuentasPago['total']*$descuentos['desarrollo'])/100;
|
||||
$totalEspecial = ($cuentasPago['total']*$descuentos['especial'])/100;
|
||||
|
||||
//$totalDescuentos = $descuentos['publicidad'] + $descuentos['flete'] + $descuentos['desarrollo'] + $descuentos['especial'];
|
||||
$totalDescuentos = $totalPublicidad+$totalDesarrollo+$totalFlete+$totalEspecial;
|
||||
|
||||
$smarty->assign('totalPublicidad', $totalPublicidad);
|
||||
$smarty->assign('totalFlete', $totalFlete);
|
||||
$smarty->assign('totalDesarrollo', $totalDesarrollo);
|
||||
$smarty->assign('totalEspecial', $totalEspecial);
|
||||
|
||||
$smarty->assign('totalDescuentos', $totalDescuentos);
|
||||
$smarty->assign('descuentos', $descuentos);
|
||||
$smarty->assign('nombreProveedor', $nombreProveedor);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/ver-descuentos-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
//PAGOS
|
||||
|
||||
case 'addPago':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$infP = $pedido->Info();
|
||||
|
||||
if($infP['total2'] > 0)
|
||||
$infP['total'] = $infP['total2'];
|
||||
|
||||
$info['folioProv'] = $infP['folioProv'];
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $infP['totalPub'] + $infP['totalDes'] + $infP['totalFlete'] + $infP['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$info['saldo'] = $infP['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
$metodosPago = $metodoPago->EnumerateAll();
|
||||
$metodosPago = $util->EncodeResult($metodosPago);
|
||||
|
||||
$ctasBancarias = $cuentaBancaria->EnumerateAll();
|
||||
$ctasBancarias = $util->EncodeResult($ctasBancarias);
|
||||
|
||||
$info['noPedido'] = $infP['noPedido'];
|
||||
$info['pedidoId'] = $pedidoId;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('metodosPago', $metodosPago);
|
||||
$smarty->assign('ctasBancarias', $ctasBancarias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-pago-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddPago':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$metodoPagoId = $_POST['metodoPagoId'];
|
||||
$cuentaBancariaId = $_POST['cuentaBancariaId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$noCheque = $_POST['noCheque'];
|
||||
$fecha = ($_POST['fecha'] != '') ? date('Y-m-d',strtotime($_POST['fecha'])) : '';
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentaPagar->setMetodoPagoId($metodoPagoId);
|
||||
$cuentaPagar->setProveedorId($info['proveedorId']);
|
||||
$cuentaPagar->setCantidad($cantidad);
|
||||
$cuentaPagar->setFecha($fecha);
|
||||
$cuentaPagar->setNoCheque($noCheque);
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
if($cantidad > $saldo){
|
||||
$util->setError(20075, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$cuentaPagar->SavePago())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Checamos si ya esta pagado totalmente
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
$pagado = ($saldo == 0) ? 1 : 0;
|
||||
|
||||
//Actualizamos el status a Pagado
|
||||
if($pagado){
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->setPagado(1);
|
||||
$pedido->UpdatePagado();
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deletePago':
|
||||
|
||||
$pedidoPagoId = $_POST['id'];
|
||||
|
||||
$cuentaPagar->setPedidoPagoId($pedidoPagoId);
|
||||
$infP = $cuentaPagar->InfoPago();
|
||||
|
||||
$pedidoId = $infP['pedidoId'];
|
||||
|
||||
if(!$cuentaPagar->DeletePago())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
//Quitamos el status de Pagado
|
||||
$pedido->setPagado(0);
|
||||
$pedido->UpdatePagado();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//NOTAS CREDITOS
|
||||
|
||||
case 'addNota':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$infP = $pedido->Info();
|
||||
|
||||
if($infP['total2'] > 0)
|
||||
$infP['total'] = $infP['total2'];
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $infP['totalPub'] + $infP['totalDes'] + $infP['totalFlete'] + $infP['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$info['saldo'] = $infP['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
$info['noPedido'] = $infP['noPedido'];
|
||||
$info['pedidoId'] = $pedidoId;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-nota-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddNota':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$noNota = $_POST['noNota'];
|
||||
$fecha = ($_POST['fecha'] != '') ? date('Y-m-d',strtotime($_POST['fecha'])) : '';
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentaPagar->setProveedorId($info['proveedorId']);
|
||||
$cuentaPagar->setNoNota($noNota);
|
||||
$cuentaPagar->setCantidad($cantidad);
|
||||
$cuentaPagar->setFecha($fecha);
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
if($cantidad > $saldo){
|
||||
$util->setError(20075, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$cuentaPagar->SaveNota())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
//Checamos si ya esta pagado totalmente
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
$pagado = ($saldo == 0) ? 1 : 0;
|
||||
|
||||
//Actualizamos el status a Pagado
|
||||
if($pagado){
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->setPagado(1);
|
||||
$pedido->UpdatePagado();
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $pedidoId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($totalNotas,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
echo $pagado;
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$item['notas'] = $notas;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-notas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteNota':
|
||||
|
||||
$pedidoNotaId = $_POST['id'];
|
||||
|
||||
$cuentaPagar->setPedidoNotaId($pedidoNotaId);
|
||||
$infN = $cuentaPagar->InfoNota();
|
||||
|
||||
$pedidoId = $infN['pedidoId'];
|
||||
|
||||
if(!$cuentaPagar->DeleteNota())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
//Quitamos el status de Pagado
|
||||
$pedido->setPagado(0);
|
||||
$pedido->UpdatePagado();
|
||||
|
||||
//Obtenemos las notas realizadas
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'];
|
||||
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $pedidoId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($totalNotas,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$item['notas'] = $notas;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-notas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//OTHERS
|
||||
|
||||
case 'search':
|
||||
|
||||
$cuentaPagar->setProveedorId($_POST['proveedorId2']);
|
||||
$resCuenta = $cuentaPagar->Search();
|
||||
|
||||
$info['total'] = 0;
|
||||
$info['totalAbonos'] = 0;
|
||||
$info['totalNotas'] = 0;
|
||||
$info['totalDesc'] = 0;
|
||||
$info['totalBonif'] = 0;
|
||||
$info['totalDev'] = 0;
|
||||
$info['totalSaldo'] = 0;
|
||||
|
||||
$items = array();
|
||||
foreach($resCuenta as $res){
|
||||
|
||||
if(preg_match('/FOLIO/i',$res['folioProv']))
|
||||
continue;
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['abonos'] = $cuentaPagar->GetTotalPagos();
|
||||
|
||||
//Obtenemos las notas de credito
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['totalNotas'] = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['bonificaciones'] = $bonificacion->getBonificaciones();
|
||||
$res['devoluciones'] = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $res['totalPub'] + $res['totalDes'] + $res['totalFlete'] + $res['totalEsp'];
|
||||
$res['totalDescuentos'] = number_format($totalDesc,2,'.','');
|
||||
|
||||
if($res['total2'] > 0)
|
||||
$res['total'] = $res['total2'];
|
||||
|
||||
$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'] - $res['totalDescuentos'] - $res['totalNotas'];
|
||||
|
||||
//Obtenemos las Notas de Credito
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$res['notas'] = $notas;
|
||||
|
||||
$info['total'] += $res['total'];
|
||||
$info['totalAbonos'] += $res['abonos'];
|
||||
$info['totalNotas'] += $res['totalNotas'];
|
||||
$info['totalDesc'] += $res['totalDescuentos'];
|
||||
$info['totalBonif'] += $res['bonificaciones'];
|
||||
$info['totalDev'] += $res['devoluciones'];
|
||||
$info['totalSaldo'] += $res['saldo'];
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$cuentasPagar['items'] = $items;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('tipo', 'search');
|
||||
$smarty->assign('cuentasPagar', $cuentasPagar);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'search2':
|
||||
|
||||
$cuentaPagar->setProveedorId($_POST['proveedorId2']);
|
||||
$resProv = $cuentaPagar->EnumProveedores();
|
||||
|
||||
$info['total'] = 0;
|
||||
$info['totalAbonos'] = 0;
|
||||
$info['totalNotas'] = 0;
|
||||
$info['totalDesc'] = 0;
|
||||
$info['totalBonif'] = 0;
|
||||
$info['totalDev'] = 0;
|
||||
$info['totalSaldo'] = 0;
|
||||
$info['totalSaldoInicial'] = 0;
|
||||
$info['totalTotal'] = 0;
|
||||
|
||||
$proveedores = array();
|
||||
foreach($resProv as $val){
|
||||
|
||||
$proveedor->setProveedorId($val['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
$val['noProv'] = $infPv['noProv'];
|
||||
$val['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$proveedor->setProveedorId($val['proveedorId']);
|
||||
$infP = $proveedor->Info();
|
||||
|
||||
$cuentaPagar->setProveedorId($val['proveedorId']);
|
||||
$resCuenta = $cuentaPagar->Search();
|
||||
|
||||
$totalG = 0;
|
||||
$totAbonos = 0;
|
||||
$totNotas = 0;
|
||||
$totBonificaciones = 0;
|
||||
$totDevoluciones = 0;
|
||||
$totDescuentos = 0;
|
||||
$totSaldo = 0;
|
||||
$facturas = array();
|
||||
foreach($resCuenta as $res){
|
||||
|
||||
if(preg_match('/FOLIO/i',$res['folioProv']))
|
||||
continue;
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['abonos'] = $cuentaPagar->GetTotalPagos();
|
||||
$res['totalNotas'] = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['bonificaciones'] = $bonificacion->getBonificaciones();
|
||||
$res['devoluciones'] = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $res['totalPub'] + $res['totalDes'] + $res['totalFlete'] + $res['totalEsp'];
|
||||
$res['totalDescuentos'] = number_format($totalDesc,2,'.','');
|
||||
|
||||
if($res['total2'] > 0)
|
||||
$res['total'] = $res['total2'];
|
||||
|
||||
$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'] - $res['totalDescuentos'] - $res['totalNotas'];
|
||||
|
||||
$totalG += $res['total'];
|
||||
$totAbonos += $res['abonos'];
|
||||
$totNotas += $res['totalNotas'];
|
||||
$totBonificaciones += $res['bonificaciones'];
|
||||
$totDevoluciones += $res['devoluciones'];
|
||||
$totDescuentos += $res['totalDescuentos'];
|
||||
$totSaldo += $res['saldo'];
|
||||
|
||||
$info['total'] += $res['total'];
|
||||
$info['totalAbonos'] += $res['abonos'];
|
||||
$info['totalNotas'] += $res['totalNotas'];
|
||||
$info['totalDesc'] += $res['totalDescuentos'];
|
||||
$info['totalBonif'] += $res['bonificaciones'];
|
||||
$info['totalDev'] += $res['devoluciones'];
|
||||
$info['totalSaldo'] += $res['saldo'];
|
||||
|
||||
//Obtenemos los Pagos
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$resPagos = $cuentaPagar->EnumPagos();
|
||||
|
||||
$pagos = array();
|
||||
foreach($resPagos as $res2){
|
||||
|
||||
$metodoPago->setMetodoPagoId($res2['metodoPagoId']);
|
||||
$res2['metodoPago'] = $metodoPago->GetNameById();
|
||||
|
||||
$res2['fecha'] = date('d-m-Y',strtotime($res2['fecha']));
|
||||
|
||||
$pagos[] = $res2;
|
||||
}
|
||||
$res['pagos'] = $pagos;
|
||||
|
||||
$facturas[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$val['facturas'] = $facturas;
|
||||
|
||||
if($totalG > 0){
|
||||
|
||||
$cuentaPagar->setProveedorId($val['proveedorId']);
|
||||
$abonosSaldoIni = $cuentaPagar->GetTotalPagosProv();
|
||||
|
||||
$val['total'] = $totalG + $infP['saldoCtaPagar'];
|
||||
$val['abonos'] += ($totAbonos + $abonosSaldoIni);
|
||||
$val['totalNotas'] += $totNotas;
|
||||
$val['bonificaciones'] += $totBonificaciones;
|
||||
$val['devoluciones'] += $totDevoluciones;
|
||||
$val['totalDescuentos'] += $totDescuentos;
|
||||
$val['saldo'] += ($totSaldo + $infP['saldoCtaPagar'] - $abonosSaldoIni);
|
||||
$val['saldoInicial'] = $infP['saldoCtaPagar'];
|
||||
$val['totalTotal'] = $val['saldo'] + $infP['saldoCtaPagar'];
|
||||
|
||||
$info['totalSaldoInicial'] += $infP['saldoCtaPagar'];
|
||||
$info['totalTotal'] += $val['totalTotal'];
|
||||
|
||||
$info['total'] += $infP['saldoCtaPagar'];
|
||||
$info['totalSaldo'] += ($infP['saldoCtaPagar'] - $abonosSaldoIni);
|
||||
$info['totalAbonos'] += $abonosSaldoIni;
|
||||
|
||||
$proveedores[] = $val;
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
$proveedores = $util->orderMultiDimensionalArray($proveedores, 'proveedor');
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('tipo', 'search');
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar2.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
77
ajax/datos-generales.php
Executable file
77
ajax/datos-generales.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'editRfc':
|
||||
|
||||
$rfc->setRfcId($_POST['id']);
|
||||
$result = $rfc->Info();
|
||||
$myRfc = $util->DecodeUrlRow($result);
|
||||
|
||||
$smarty->assign('post', $myRfc);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-rfc-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditRfc':
|
||||
|
||||
$rfc->setRfcId($_POST['rfcId']);
|
||||
$rfc->setRfc($_POST['rfc']);
|
||||
$rfc->setRazonSocial($_POST['razonSocial']);
|
||||
$rfc->setCalle($_POST['calle']);
|
||||
$rfc->setNoExt($_POST['noExt']);
|
||||
$rfc->setNoInt($_POST['noInt']);
|
||||
$rfc->setReferencia($_POST['referencia']);
|
||||
$rfc->setColonia($_POST['colonia']);
|
||||
$rfc->setLocalidad($_POST['localidad']);
|
||||
$rfc->setMunicipio($_POST['municipio']);
|
||||
$rfc->setCiudad($_POST['ciudad']);
|
||||
$rfc->setEstado($_POST['estado']);
|
||||
$rfc->setPais($_POST['pais']);
|
||||
$rfc->setCodigoPostal($_POST['cp']);
|
||||
$rfc->setRegimenFiscal($_POST['regimenFiscal']);
|
||||
|
||||
$rfc->setDiasDevolucion($_POST['diasDevolucion']);
|
||||
$rfc->setBonificacion($_POST['bonificacion']);
|
||||
$rfc->setDevolucion($_POST['devolucion']);
|
||||
|
||||
if(!$rfc->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$result = $rfc->GetRfcsByEmpresa();
|
||||
$empresaRfcs = $util->DecodeUrlResult($result);
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->assign('empresaRfcs', $empresaRfcs);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/datos-generales.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'viewRfc':
|
||||
|
||||
$rfc->setRfcId($_POST['id']);
|
||||
$result = $rfc->Info();
|
||||
$myRfc = $util->DecodeUrlRow($result);
|
||||
|
||||
$smarty->assign('post', $myRfc);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/detalles-rfc-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
278
ajax/descuentos.php
Executable file
278
ajax/descuentos.php
Executable file
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'saveDescuentos':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
$tipoDesc = $_POST['tipoDesc'];
|
||||
$valDesc = $_POST['valDesc'];
|
||||
|
||||
$prodDesc = $_SESSION['prodDesc'];
|
||||
|
||||
$total = 0;
|
||||
foreach($prodDesc as $res){
|
||||
|
||||
$descVal = 0;
|
||||
if($res['tipoDesc'] == 'Dinero')
|
||||
$descVal = $res['valDesc'];
|
||||
elseif($res['tipoDesc'] == 'Porcentaje'){
|
||||
$descVal = $res['precioUnitario'] * ($res['valDesc']/100);
|
||||
$descVal = number_format($descVal,2,'.','');
|
||||
}
|
||||
|
||||
$total += $res['total'] - ($descVal * $res['cantidad']);
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($res['prodItemId']);
|
||||
$venta->setTipoDesc($res['tipoDesc']);
|
||||
$venta->setTotal($res['valDesc']);
|
||||
$venta->UpdateDescProd();
|
||||
}
|
||||
|
||||
$descVal = 0;
|
||||
if($tipoDesc == 'Dinero')
|
||||
$descVal = $valDesc;
|
||||
elseif($tipoDesc == 'Porcentaje')
|
||||
$descVal = $total * ($valDesc/100);
|
||||
|
||||
$total -= $descVal;
|
||||
|
||||
//Obtenemos los Totales
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$porcIva = $sucursal->GetIva();
|
||||
$porcIva = $porcIva / 100;
|
||||
|
||||
$subtotal = $total / (1 + $porcIva);
|
||||
$subtotal = number_format($subtotal,2,'.','');
|
||||
|
||||
$iva = $subtotal * $porcIva;
|
||||
$iva = number_format($iva,2,'.','');
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setTipoDesc($tipoDesc);
|
||||
$venta->setValDesc($valDesc);
|
||||
$venta->setSubtotal($subtotal);
|
||||
$venta->setIva($iva);
|
||||
$venta->setTotal($total);
|
||||
|
||||
$venta->UpdateDescVta();
|
||||
|
||||
$_SESSION['prodDesc'] = array();
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
case 'updatePrecios':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
$tipoDesc = $_POST['tipoDesc'];
|
||||
$valDesc = $_POST['valDesc'];
|
||||
$k = $_POST['k'];
|
||||
|
||||
$resProds = $_SESSION['prodDesc'];
|
||||
|
||||
$productoId = $_SESSION['prodDesc'][$k]['productoId'];
|
||||
|
||||
$prodDesc = array();
|
||||
foreach($resProds as $kP => $res){
|
||||
|
||||
if($res['productoId'] == $productoId){
|
||||
|
||||
$res['tipoDesc'] = $tipoDesc;
|
||||
$res['valDesc'] = $valDesc;
|
||||
|
||||
}//if
|
||||
|
||||
$prodDesc[$kP] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
/*
|
||||
$venta->setVentaId($ventaId);
|
||||
$info = $venta->Info();
|
||||
|
||||
$card = array();
|
||||
|
||||
$card = $_SESSION['prodDesc'][$k];
|
||||
$total = $card['total'];
|
||||
$precioUni = $card['precioUnitario'];
|
||||
|
||||
$descVal = 0;
|
||||
if($tipoDesc == 'Dinero')
|
||||
$descVal = $valDesc;
|
||||
elseif($tipoDesc == 'Porcentaje')
|
||||
$descVal = $total * ($valDesc/100);
|
||||
|
||||
$card['tipoDesc'] = $tipoDesc;
|
||||
$card['valorDesc'] = $valDesc;
|
||||
$card['valDesc'] = $descVal;
|
||||
|
||||
$_SESSION['prodDesc'][$k] = $card;
|
||||
|
||||
$total -= $descVal;
|
||||
|
||||
$prodDesc = $_SESSION['prodDesc'];
|
||||
*/
|
||||
|
||||
$_SESSION['prodDesc'] = $prodDesc;
|
||||
|
||||
$total = 0;
|
||||
$totalP = 0;
|
||||
foreach($prodDesc as $res){
|
||||
|
||||
if($res['productoId'] == $productoId){
|
||||
|
||||
$descVal = 0;
|
||||
if($res['tipoDesc'] == 'Dinero')
|
||||
$descVal = $res['valDesc'];
|
||||
elseif($res['tipoDesc'] == 'Porcentaje'){
|
||||
$descVal = $res['precioUnitario'] * ($res['valDesc']/100);
|
||||
$descVal = number_format($descVal,2,'.','');
|
||||
}
|
||||
|
||||
$totalD = $res['cantidad'] * $descVal;
|
||||
$total += $res['total'] - $totalD;
|
||||
|
||||
}//if
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
echo number_format($total,2);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'updateTotales':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
$tipoDesc = $_POST['tipoDesc'];
|
||||
$valDesc = $_POST['valDesc'];
|
||||
|
||||
$prodDesc = $_SESSION['prodDesc'];
|
||||
|
||||
$total = 0;
|
||||
foreach($prodDesc as $res){
|
||||
|
||||
$descVal = 0;
|
||||
if($res['tipoDesc'] == 'Dinero')
|
||||
$descVal = $res['valDesc'];
|
||||
elseif($res['tipoDesc'] == 'Porcentaje'){
|
||||
$descVal = $res['precioUnitario'] * ($res['valDesc']/100);
|
||||
$descVal = number_format($descVal,2,'.','');
|
||||
}
|
||||
|
||||
$totalD = $res['cantidad'] * $descVal;
|
||||
$total += $res['total'] - $totalD;
|
||||
|
||||
}
|
||||
|
||||
$descVal = 0;
|
||||
if($tipoDesc == 'Dinero')
|
||||
$descVal = $valDesc;
|
||||
elseif($tipoDesc == 'Porcentaje')
|
||||
$descVal = $total * ($valDesc/100);
|
||||
|
||||
$total -= $descVal;
|
||||
|
||||
//Obtenemos los Totales
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$porcIva = $sucursal->GetIva();
|
||||
$porcIva = $porcIva / 100;
|
||||
|
||||
$subtotal = $total / (1 + $porcIva);
|
||||
$subtotal = number_format($subtotal,2,'.','');
|
||||
|
||||
$iva = $subtotal * $porcIva;
|
||||
$iva = number_format($iva,2,'.','');
|
||||
|
||||
echo 'ok[#]';
|
||||
echo number_format($subtotal,2);
|
||||
echo '[#]';
|
||||
echo number_format($iva,2);
|
||||
echo '[#]';
|
||||
echo number_format($total,2);
|
||||
|
||||
break;
|
||||
|
||||
case 'cancelarDescuentos':
|
||||
|
||||
$_SESSION['prodDesc'] = array();
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
case 'cancelVenta':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
|
||||
if(!$venta->CancelVenta()){
|
||||
echo 'fail[#]';
|
||||
exit;
|
||||
}
|
||||
|
||||
//Devolvemos los productos a inventario
|
||||
$venta->DevolverProductos();
|
||||
|
||||
//Enumeramos los Descuentos
|
||||
$descuento->setSucursalId($sucursalId);
|
||||
$ventas = $descuento->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($ventas['items'] as $res){
|
||||
|
||||
$fecha = date('d-m-Y',strtotime($res['fecha']));
|
||||
$hora = date('H:i:s',strtotime($res['fecha']));
|
||||
$fecha = $util->FormatDateDMMMY($fecha);
|
||||
$res['fecha'] = $fecha.' '.$hora;
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetFullNameById();
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = utf8_decode(urldecode($sucursal->GetNameById()));
|
||||
|
||||
if($res['status'] == 'DescAp')
|
||||
$res['total'] = $res['totalDesc'];
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$ventas['items'] = $items;
|
||||
|
||||
$util->setError(20111,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$smarty->assign('ventas', $ventas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/descuentos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
191
ajax/devoluciones-cedis.php
Executable file
191
ajax/devoluciones-cedis.php
Executable file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'saveDevolucion':
|
||||
|
||||
$products = $_SESSION['prodsDevC'];
|
||||
|
||||
$devolucion->setFecha(date('Y-m-d H:i:s'));
|
||||
$devolucion->setUsuarioId($_SESSION['loginKey']);
|
||||
|
||||
$devolucion->SaveDevCedis();
|
||||
$devCedisId = $devolucion->GetInsertIdCedis();
|
||||
|
||||
//Guardamos los Productos
|
||||
|
||||
$devolucion->setDevCedisId($devCedisId);
|
||||
|
||||
foreach($products as $res){
|
||||
|
||||
$devolucion->setSucursalId($res['sucursalId']);
|
||||
$devolucion->setProductoId($res['productoId']);
|
||||
$devolucion->setCantidad($res['cantidad']);
|
||||
$devolucion->setDisponible($res['disponible']);
|
||||
|
||||
$devolucion->SaveProdCedis();
|
||||
|
||||
//Bloqueamos los productos
|
||||
$devolucion->UpdateDevProd();
|
||||
|
||||
}//foreach
|
||||
|
||||
|
||||
$_SESSION['msgDevC'] = 'Saved';
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteDev':
|
||||
|
||||
$devolucion->setDevCedisId($_POST['devCedisId']);
|
||||
|
||||
if(!$devolucion->DeleteCedis())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
//Desbloqueamos los productos
|
||||
$devolucion->UpdateDispProd();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$devoluciones = $devolucion->EnumerateCedis();
|
||||
|
||||
$items = array();
|
||||
foreach($devoluciones['items'] as $res){
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetNameById();
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$devoluciones['items'] = $items;
|
||||
|
||||
$smarty->assign('devoluciones', $devoluciones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/devoluciones-cedis.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//PRODUCTOS
|
||||
|
||||
case 'addProducto':
|
||||
|
||||
$products = $_SESSION['prodsDevC'];
|
||||
$productoId = $_POST['productoId'];
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
$cantidad = intval($_POST['cantidad']);
|
||||
|
||||
//Checamos si ya se encuentra el producto agregado
|
||||
|
||||
if($productoId == '')
|
||||
$noError = 20058;
|
||||
|
||||
if($cantidad <= 0)
|
||||
$noError = 30018;
|
||||
|
||||
if(count($products) == 0)
|
||||
$products = array();
|
||||
|
||||
$prodFound = 0;
|
||||
if($productoId){
|
||||
foreach($products as $res){
|
||||
if($res['productoId'] == $productoId && $res['sucursalId'] == $sucursalId){
|
||||
$prodFound = 1;
|
||||
$noError = 20060;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($noError){
|
||||
$util->setError($noError, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$smarty->assign('products', $products);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-productos-dev.tpl');
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$card['sucursalId'] = $sucursalId;
|
||||
$card['productoId'] = $productoId;
|
||||
$card['proveedor'] = $prodCatId;
|
||||
$card['cantidad'] = $cantidad;
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$card['disponible'] = $inventario->GetDispByProd();
|
||||
|
||||
$prodCat->setProdCatId($infP['prodCatId']);
|
||||
$card['departamento'] = utf8_encode($prodCat->GetNameById());
|
||||
|
||||
$prodSubcat->setProdSubcatId($infP['prodSubcatId']);
|
||||
$card['linea'] = utf8_encode($prodSubcat->GetNameById());
|
||||
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
|
||||
$card['atributos'] = utf8_encode($producto->GetAtributosAll());
|
||||
|
||||
$products[] = $card;
|
||||
|
||||
$_SESSION['prodsDevC'] = $products;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('products', $products);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-productos-dev.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteProducto':
|
||||
|
||||
$k = $_POST['k'];
|
||||
|
||||
$products = $_SESSION['prodsDevC'];
|
||||
|
||||
unset($products[$k]);
|
||||
|
||||
$_SESSION['prodsDevC'] = $products;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('products', $products);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-productos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
561
ajax/devoluciones.php
Executable file
561
ajax/devoluciones.php
Executable file
@@ -0,0 +1,561 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addDevolucion':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-devolucion-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveDevolucion':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
$codigo = strtoupper(trim($_POST['codigo']));
|
||||
$conceptosD = $_SESSION['conceptosD'];
|
||||
|
||||
if(count($conceptosD) == 0){
|
||||
echo 'fail[#]';
|
||||
echo 'Debe agregar al menos un producto.';
|
||||
exit;
|
||||
}
|
||||
|
||||
//Obtenemos los Totales
|
||||
|
||||
$total = 0;
|
||||
foreach($conceptosD as $res)
|
||||
$total += $res['total'];
|
||||
|
||||
$card['total'] = $total;
|
||||
$card['ventaId'] = $ventaId;
|
||||
$_SESSION['infDev'] = $card;
|
||||
|
||||
echo 'ok[#]';
|
||||
exit;
|
||||
|
||||
//Obtenemos la informacion de la Venta
|
||||
/*
|
||||
$devolucion->setVentaId($ventaId);
|
||||
$infV = $devolucion->InfoVenta();
|
||||
$totalP = $devolucion->GetCantAllProds();
|
||||
|
||||
$fecha = date('Y-m-d H:i:s');
|
||||
|
||||
$devolucion->setVentaId($ventaId);
|
||||
$devolucion->setSucursalId($sucursalId);
|
||||
$devolucion->setUsuarioId($_SESSION['loginKey']);
|
||||
$devolucion->setFecha($fecha);
|
||||
$devolucion->setTotal($total);
|
||||
|
||||
$devolucionId = $devolucion->Save();
|
||||
*/
|
||||
|
||||
//Guardamos los Productos
|
||||
/*
|
||||
$totalProdDev = 0;
|
||||
foreach($conceptosD as $res){
|
||||
|
||||
$prodItemId = $res['prodItemId'];
|
||||
|
||||
$producto->setProdItemId($prodItemId);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$devolucion->setDevolucionId($devolucionId);
|
||||
$devolucion->setProdItemId($prodItemId);
|
||||
$devolucion->setProductoId($info['productoId']);
|
||||
$devolucion->setCantidad($res['cantidad']);
|
||||
$devolucion->setPrecioUnitario($res['precio']);
|
||||
$devolucion->setTotal($res['total']);
|
||||
|
||||
$devolucion->SaveProducto();
|
||||
|
||||
$totalProdDev += $res['cantidad'];
|
||||
|
||||
}//foreach
|
||||
*/
|
||||
/*
|
||||
$valDesc = 0;
|
||||
if($infV['tipoDesc'] == 'Dinero'){
|
||||
$valDesc = $infV['valDesc'] / $totalP;
|
||||
$valDesc = number_format($valDesc,2,'.','');
|
||||
$valDesc = $infV['valDesc'] - ($valDesc * $totalProd);
|
||||
$infV['valDesc'] = $valDesc;
|
||||
$conDesc = true;
|
||||
}elseif($infV['tipoDesc'] == 'Porcentaje'){
|
||||
$valDesc = ($infV['valDesc'] / 100) * $totalDesc;
|
||||
$valDesc = number_format($valDesc,2,'.','');
|
||||
$conDesc = true;
|
||||
}
|
||||
*/
|
||||
|
||||
$conceptosD = array();
|
||||
$_SESSION['conceptosD'] = array();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $devolucionId;
|
||||
|
||||
break;
|
||||
|
||||
case 'getProdInfoDev':
|
||||
|
||||
$ventaId = $_POST['ventaId'];
|
||||
$prodItemId = $_POST['prodItemId'];
|
||||
|
||||
$producto->setProdItemId($prodItemId);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($prodItemId);
|
||||
$infP = $venta->InfoProducto();
|
||||
|
||||
$infV = $venta->Info();
|
||||
$totalP = $venta->GetCantAllProds();
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($prodItemId);
|
||||
$disponible = $venta->GetProdDispVta();
|
||||
|
||||
$conceptosD = $_SESSION['conceptosD'];
|
||||
$conceptosD = $util->CheckArray($conceptosD);
|
||||
|
||||
foreach($conceptosD as $res){
|
||||
if($res['prodItemId'] == $prodItemId)
|
||||
$disponible -= $res['cantidad'];
|
||||
}
|
||||
|
||||
$producto->setProdItemId($prodItemId);
|
||||
$nombre = $producto->GetFullName();
|
||||
|
||||
$precioUni = $infP['precioUnitario'];
|
||||
|
||||
//Checamos si tiene descuento
|
||||
if($infP['tipoDesc'] == 'Porcentaje'){
|
||||
$totalDesc = ($infP['valDesc'] / 100) * $infP['precioUnitario'];
|
||||
$precioUni = $precioUni - $totalDesc;
|
||||
}else{
|
||||
$precioUni = $precioUni - $infP['valDesc'];
|
||||
}
|
||||
|
||||
if($infV['tipoDesc'] == 'Dinero'){
|
||||
$valDesc = $infV['valDesc'] / $totalP;
|
||||
$valDesc = number_format($valDesc,2,'.','');
|
||||
$precioUni -= $valDesc;
|
||||
}elseif($infV['tipoDesc'] == 'Porcentaje'){
|
||||
$totalDesc = ($infV['valDesc'] / 100) * $precioUni;
|
||||
$totalDesc = number_format($totalDesc,2,'.','');
|
||||
$precioUni = $precioUni - $totalDesc;
|
||||
}
|
||||
|
||||
if($precioUni == '')
|
||||
$precioUni = '0.00';
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $precioUni;
|
||||
echo '[#]';
|
||||
echo $disponible;
|
||||
echo '[#]';
|
||||
echo $nombre;
|
||||
|
||||
break;
|
||||
|
||||
case 'getProdInfoDevByCode':
|
||||
|
||||
$ventaId = trim($_POST['ventaId']);
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
if($ventaId == ''){
|
||||
echo 'fail[#]';
|
||||
echo 'Por favor, ingrese el Folio Novomoda.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$infV = $venta->Info();
|
||||
|
||||
if($infV['sucursalId'] != $sucursalId){
|
||||
echo 'fail[#]';
|
||||
echo 'El folio no corresponde a esta sucursal. Por favor, verifique.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
if($venta->BuenFinAplicado()){
|
||||
echo 'fail[#]';
|
||||
echo 'La venta tiene promocion del Buen Fin aplicada. No se puede realizar la devolucion.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$prodItemId = $producto->GetProductByCodigo();
|
||||
|
||||
$producto->setProdItemId($prodItemId);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($prodItemId);
|
||||
$infP = $venta->InfoProducto();
|
||||
|
||||
$venta->setProductoId($infP['productoId']);
|
||||
if($venta->IsProdRebajado()){
|
||||
echo 'fail[#]';
|
||||
echo 'Lo sentimos, pero el producto ingresado tiene rebaja y no aplica para devolucion.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$infV = $venta->Info();
|
||||
$totalP = $venta->GetCantAllProds();
|
||||
|
||||
if($infV['status'] == "Cancelado"){
|
||||
echo 'fail[#]';
|
||||
echo 'Lo sentimos, pero la Nota de Venta se encuentra cancelada.';
|
||||
exit;
|
||||
}
|
||||
|
||||
if($infV['status'] == "Facturada"){
|
||||
echo 'fail[#]';
|
||||
echo 'Lo sentimos, pero la Nota de Venta se encuentra facturada. Debe cancelarla para poder realizar la devolucion.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$fechaV = date('Y-m-d',strtotime($infV['fecha']));
|
||||
$fechaHoy = date('Y-m-d');
|
||||
$dias = $util->GetDiffDates($fechaV, $fechaHoy);
|
||||
|
||||
$rfc->setRfcId(1);
|
||||
$infR = $rfc->Info();
|
||||
|
||||
$diasDevolucion = $infR['diasDevolucion'];
|
||||
|
||||
$aplicaDev = true;
|
||||
if($dias > $diasDevolucion)
|
||||
$aplicaDev = false;
|
||||
|
||||
if(!$aplicaDev){
|
||||
echo 'fail[#]';
|
||||
echo 'Lo sentimos, pero la Nota de Venta tiene mas de '.$diasDevolucion.' dias. ';
|
||||
echo 'Por lo tanto no aplica la devolucion.';
|
||||
exit;
|
||||
}//else
|
||||
|
||||
/*
|
||||
if($infV['promocionId']){
|
||||
echo 'fail[#]';
|
||||
echo 'Lo sentimos, pero por el momento no se pueden realizar devoluciones en ventas con promocion aplicada.';
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($prodItemId);
|
||||
$disponible = $venta->GetProdDispVta();
|
||||
|
||||
$conceptosD = $_SESSION['conceptosD'];
|
||||
$conceptosD = $util->CheckArray($conceptosD);
|
||||
|
||||
foreach($conceptosD as $res){
|
||||
if($res['prodItemId'] == $prodItemId)
|
||||
$disponible -= $res['cantidad'];
|
||||
}
|
||||
|
||||
$producto->setProductoId($info['productoId']);
|
||||
$nombre = $producto->GetModeloById();
|
||||
|
||||
$precioUni = $infP['precioUnitario'];
|
||||
|
||||
//Checamos si tiene descuento
|
||||
if($infP['tipoDesc'] == 'Porcentaje'){
|
||||
$totalDesc = ($infP['valDesc'] / 100) * $infP['precioUnitario'];
|
||||
$precioUni = $precioUni - $totalDesc;
|
||||
}else{
|
||||
$precioUni = $precioUni - $infP['valDesc'];
|
||||
}
|
||||
|
||||
if($infV['tipoDesc'] == 'Dinero'){
|
||||
$valDesc = $infV['valDesc'] / $totalP;
|
||||
$valDesc = number_format($valDesc,2,'.','');
|
||||
$precioUni -= $valDesc;
|
||||
}elseif($infV['tipoDesc'] == 'Porcentaje'){
|
||||
$totalDesc = ($infV['valDesc'] / 100) * $precioUni;
|
||||
$totalDesc = number_format($totalDesc,2,'.','');
|
||||
$precioUni = $precioUni - $totalDesc;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo number_format($precioUni,2,'.','');
|
||||
echo '[#]';
|
||||
echo $disponible;
|
||||
echo '[#]';
|
||||
echo utf8_encode($nombre);
|
||||
echo '[#]';
|
||||
echo $prodItemId;
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'cobrarDev':
|
||||
|
||||
$conceptosD = $_SESSION['conceptosD'];
|
||||
|
||||
if(count($conceptosD) == 0){
|
||||
echo 'fail[#]';
|
||||
echo 'Debe agregar al menos un producto.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
foreach($conceptosD as $res)
|
||||
$total += $res['total'];
|
||||
|
||||
$total = number_format($total,2);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('total', $total);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/cobrar-devolucion-popup.tpl');
|
||||
|
||||
break;
|
||||
*/
|
||||
|
||||
case 'cancelarDevolucion':
|
||||
|
||||
$_SESSION['conceptosD'] = array();
|
||||
|
||||
$conceptosD = array();
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('conceptos', $conceptosD);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos.tpl');
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'limpiarForm':
|
||||
|
||||
$conceptosD = array();
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('conceptos', $conceptosD);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
//PRODUCTOS
|
||||
|
||||
case 'addProduct':
|
||||
|
||||
$prodItemId = $_POST['prodItemId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$ventaId = $_POST['ventaId'];
|
||||
|
||||
$producto->setProdItemId($prodItemId);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setProdItemId($prodItemId);
|
||||
$infP = $venta->InfoProducto();
|
||||
|
||||
$infV = $venta->Info();
|
||||
$totalP = $venta->GetCantAllProds();
|
||||
|
||||
$name = $info['codigoBarra'].'<br>';
|
||||
|
||||
$producto->setProductoId($infP['productoId']);
|
||||
$name .= $producto->GetModeloById();
|
||||
|
||||
//Checamos si tiene descuento
|
||||
if($infP['tipoDesc'] == 'Porcentaje'){
|
||||
$totalDesc = ($infP['valDesc'] / 100) * $infP['precioUnitario'];
|
||||
$precioUni = $infP['precioUnitario'] - $totalDesc;
|
||||
}else{
|
||||
$precioUni = $infP['precioUnitario'] - $infP['valDesc'];
|
||||
}
|
||||
|
||||
if($infV['tipoDesc'] == 'Dinero'){
|
||||
|
||||
$valDesc = $infV['valDesc'] / $totalP;
|
||||
$valDesc = number_format($valDesc,2,'.','');
|
||||
$precioUni -= $valDesc;
|
||||
|
||||
}elseif($infV['tipoDesc'] == 'Porcentaje'){
|
||||
|
||||
$totalDesc = ($infV['valDesc'] / 100) * $precioUni;
|
||||
$totalDesc = number_format($totalDesc,2,'.','');
|
||||
$precioUni = $precioUni - $totalDesc;
|
||||
|
||||
}
|
||||
|
||||
if($precioUni == '')
|
||||
$precioUni = '0.00';
|
||||
|
||||
$card['productoId'] = $infP['productoId'];
|
||||
$card['name'] = utf8_encode($name);
|
||||
$card['prodItemId'] = $prodItemId;
|
||||
$card['cantidad'] = $cantidad;
|
||||
$card['descuento'] = '0.00';
|
||||
$card['precio'] = $precioUni;
|
||||
$total = $card['precio'] * $cantidad;
|
||||
$card['total'] = number_format($total,2,'.','');
|
||||
|
||||
$conceptosD = $_SESSION['conceptosD'];
|
||||
|
||||
$conceptosD[] = $card;
|
||||
|
||||
$_SESSION['conceptosD'] = $conceptosD;
|
||||
|
||||
$total = 0;
|
||||
foreach($conceptosD as $res)
|
||||
$total += $res['total'];
|
||||
|
||||
//Agrupamos los Productos solo para Vista
|
||||
|
||||
$prodIds = array();
|
||||
foreach($conceptosD as $res){
|
||||
|
||||
$productoId = $res['productoId'];
|
||||
|
||||
if(!in_array($productoId, $prodIds))
|
||||
$prodIds[] = $productoId;
|
||||
|
||||
}//foreach
|
||||
|
||||
$card = array();
|
||||
$concepts = array();
|
||||
foreach($prodIds as $productoId){
|
||||
|
||||
$total2 = 0;
|
||||
$precio = 0;
|
||||
$cantidad = 0;
|
||||
$card = array();
|
||||
foreach($conceptosD as $res){
|
||||
|
||||
if($res['productoId'] == $productoId){
|
||||
$card = $res;
|
||||
|
||||
if($res['precio'] > $precio)
|
||||
$precio = $res['precio'];
|
||||
|
||||
$cantidad += $res['cantidad'];
|
||||
|
||||
if($res['descuento'] == '100%')
|
||||
$res['total'] = 0;
|
||||
|
||||
$total2 += $res['total'];
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
$card['precio'] = $precio;
|
||||
$card['cantidad'] = $cantidad;
|
||||
$card['total'] = $total2;
|
||||
|
||||
$concepts[] = $card;
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('conceptos', $concepts);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos.tpl');
|
||||
|
||||
echo '[#]';
|
||||
echo number_format($total,2);
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteProduct':
|
||||
|
||||
$k = $_POST['k'];
|
||||
|
||||
/****/
|
||||
|
||||
$resConceptos = $_SESSION['conceptosD'];
|
||||
|
||||
$infP = $resConceptos[$k];
|
||||
|
||||
$conceptosD = array();
|
||||
foreach($resConceptos as $res){
|
||||
|
||||
if($infP['productoId'] != $res['productoId'])
|
||||
$conceptosD[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$_SESSION['conceptosD'] = $conceptosD;
|
||||
|
||||
//Obtenemos los Totales
|
||||
|
||||
$total = 0;
|
||||
foreach($conceptosD as $res)
|
||||
$total += $res['total'];
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('conceptos', $conceptosD);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos.tpl');
|
||||
|
||||
echo '[#]';
|
||||
echo number_format($total,2);
|
||||
echo '[#]';
|
||||
echo $infP['prodItemId'];
|
||||
|
||||
break;
|
||||
|
||||
case 'searchDevs':
|
||||
|
||||
$devolucion->setSucursalId($_POST['sucursalId2']);
|
||||
$devolucion->setUsuarioId($_POST['usuarioId2']);
|
||||
$devolucion->setFechaI(date('Y-m-d',strtotime($_POST['fechaIni2'])));
|
||||
$devolucion->setFechaF(date('Y-m-d',strtotime($_POST['fechaFin2'])));
|
||||
$resDevs = $devolucion->Search();
|
||||
|
||||
$items = array();
|
||||
foreach($resDevs as $res){
|
||||
|
||||
$fecha = date('d-m-Y',strtotime($res['fecha']));
|
||||
$hora = date('H:i:s',strtotime($res['fecha']));
|
||||
$fecha = $util->FormatDateDMMMY($fecha);
|
||||
$res['fecha'] = $fecha.' '.$hora;
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetNameById();
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = utf8_decode(urldecode($sucursal->GetNameById()));
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$devoluciones['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('devoluciones', $devoluciones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/devoluciones.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
530
ajax/envios-recibir-reporte.php
Executable file
530
ajax/envios-recibir-reporte.php
Executable file
@@ -0,0 +1,530 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addProducto':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-envio-reporte-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveProducto':
|
||||
|
||||
$envioId = trim($_POST['envioId']);
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
$tipo = $_POST['tipo'];
|
||||
$cantidad = trim($_POST['cantidad']);
|
||||
$sucursalId = $Usr['sucursalId'];
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$infE = $envio->Info();
|
||||
|
||||
$noError = '';
|
||||
if($envioId == '')
|
||||
$noError = 10053;
|
||||
elseif($codigoBarra == '')
|
||||
$noError = 20106;
|
||||
elseif($cantidad == '')
|
||||
$noError = 20130;
|
||||
else{
|
||||
|
||||
if($infE['sucursalId'] != $sucursalId)
|
||||
$noError = 20131;
|
||||
}
|
||||
|
||||
if($noError){
|
||||
$util->setError($noError,'','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Checamos si existe el producto en el pedido.
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo2();
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$envio->setProductoId($productoId);
|
||||
|
||||
if($infE['tipo'] == 'CT')
|
||||
$existe = $envio->ExistProductoRec();
|
||||
else
|
||||
$existe = $envio->ExistProductoRecTT();
|
||||
|
||||
if(!$existe){
|
||||
$util->setError(20132,'','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Checamos si ya se agrego el producto al reporte
|
||||
$existe = $envio->ExistProductoRep();
|
||||
|
||||
if($existe){
|
||||
$util->setError(20133,'','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Obtenemos el total recibido
|
||||
$envio->setEnvioId($envioId);
|
||||
$envio->setProductoId($productoId);
|
||||
|
||||
if($infE['tipo'] == 'CT')
|
||||
$total = $envio->GetTotalProdsRec();
|
||||
else
|
||||
$total = $envio->GetTotalProdsRecTT();
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$envio->setSucursalId($sucursalId);
|
||||
$envio->setProductoId($productoId);
|
||||
$envio->setTotal($total);
|
||||
$envio->setTipo($tipo);
|
||||
$envio->setCantidad($cantidad);
|
||||
$envio->setUsuarioId($_SESSION['loginKey']);
|
||||
|
||||
if(!$envio->SaveReporteProd())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$envio->setSucursalId($Usr['sucursalId']);
|
||||
$productos = $envio->EnumRepProd();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($card['tipo'] == 'Faltante')
|
||||
$card['recibido'] = $card['total'] - $card['cantidad'];
|
||||
else
|
||||
$card['recibido'] = $card['total'] + $card['cantidad'];
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-productos-recibidos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteProducto':
|
||||
|
||||
$envRepProdId = $_POST['envRepProdId'];
|
||||
|
||||
$envio->setEnvRepProdId($envRepProdId);
|
||||
|
||||
if(!$envio->DelEnvRepProd())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$envio->setSucursalId($Usr['sucursalId']);
|
||||
$productos = $envio->EnumRepProd();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($card['tipo'] == 'Faltante')
|
||||
$card['recibido'] = $card['total'] - $card['cantidad'];
|
||||
else
|
||||
$card['recibido'] = $card['total'] + $card['cantidad'];
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-productos-recibidos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'autorizarProducto':
|
||||
|
||||
$envRepProdId = $_POST['envRepProdId'];
|
||||
$envio->setEnvRepProdId($envRepProdId);
|
||||
|
||||
if(!$envio->AutorizarRepProd())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
|
||||
$envio->setEnvRepProdId($envRepProdId);
|
||||
$infR = $envio->InfoRepProd();
|
||||
|
||||
$envio->setEnvioId($infR['envioId']);
|
||||
$infE = $envio->Info();
|
||||
|
||||
//Si es Faltante ajustamos el Inventario eliminando los productos faltantes si la Tienda Origen
|
||||
//No es 00 Bodega Lerma
|
||||
//Si es envio de T a T se regresan los productos a la sucursal Origen siempre y cuando No sea
|
||||
//00 Bodega Lerma
|
||||
|
||||
//Si Suc. 1 envia 10 Pzas. a Suc 2, y Suc. 2 reporta faltante de 3 piezas
|
||||
//esas 3 piezas se regresaa Suc. 1
|
||||
|
||||
if($infR['tipo'] == 'Faltante'){
|
||||
|
||||
$envio->setEnvioId($infR['envioId']);
|
||||
$envio->setProductoId($infR['productoId']);
|
||||
$envio->setCantidad($infR['cantidad']);
|
||||
$envio->setSucursalId($infE['sucOrigen']);
|
||||
|
||||
if($infE['tipo'] == 'CT')
|
||||
$envio->AjustarInventario();
|
||||
elseif($infE['tipo'] == 'TT' && $infE['sucOrigen'] != 32)
|
||||
$envio->AjustarInventarioTT();
|
||||
elseif($infE['tipo'] == 'TT' && $infE['sucOrigen'] == 32)
|
||||
$envio->AjustarInventario();
|
||||
|
||||
}elseif($infR['tipo'] == 'Sobrante'){
|
||||
|
||||
$productoId = $infR['productoId'];
|
||||
$sucursalId = $infR['sucursalId'];
|
||||
$cantidad = $infR['cantidad'];
|
||||
|
||||
$db = $util->DBSelect(15);
|
||||
|
||||
$sql = 'SELECT proveedorId FROM producto WHERE productoId = "'.$productoId.'"';
|
||||
$db->setQuery($sql);
|
||||
$proveedorId = $db->GetSingle();
|
||||
|
||||
//Obtenemos el Sig. No de Pedido
|
||||
$sql = 'SELECT MAX(noPedido) FROM pedido';
|
||||
$db->setQuery($sql);
|
||||
$noPedido = $db->GetSingle();
|
||||
|
||||
$noPedido++;
|
||||
|
||||
//CARGAMOS LOS PRODUCTOS
|
||||
|
||||
$sql = 'INSERT INTO pedido
|
||||
(
|
||||
proveedorId,
|
||||
folioProv,
|
||||
noPedido,
|
||||
fecha,
|
||||
fechaEntrega,
|
||||
metodoCompra,
|
||||
resurtido,
|
||||
usuarioId,
|
||||
fechaAprobacion,
|
||||
userIdAprobacion,
|
||||
|
||||
fechaDistribucion,
|
||||
userIdDistribucion,
|
||||
|
||||
fechaAutorizacion,
|
||||
userIdAutorizacion,
|
||||
|
||||
fechaOrdenCompEnv,
|
||||
userIdOrdenCompEnv,
|
||||
|
||||
fechaOrdenCompIng,
|
||||
userIdOrdenCompIng,
|
||||
ajuste,
|
||||
status
|
||||
)VALUES(
|
||||
"'.$proveedorId.'",
|
||||
"FOLIO'.$noPedido.'",
|
||||
"'.$noPedido.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.date('Y-m-d').'",
|
||||
"conIva",
|
||||
"0",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"6",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"4",
|
||||
"1",
|
||||
"EnvSuc"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$pedidoId = $db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
$sql = 'INSERT INTO pedidoColor (pedidoId, productoId, colorId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 2, '.$cantidad.')';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoTalla (pedidoId, productoId, tallaId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 1, 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoDistribucion (pedidoId, productoId, sucursalId, cantidad, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$sucursalId.'", "'.$cantidad.'", "Enviado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoProducto (pedidoId, productoId, prodCatId, prodSubcatId, totalLote,
|
||||
cantLotes, cantPrendas, prendasComp, costo, precioVenta, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$infP['prodCatId'].'", "'.$infP['prodSubcatId'].'", "'.$cantidad.'",
|
||||
1, "'.$cantidad.'","1","'.$infP['costo'].'", "'.$infP['precioVentaIva'].'" ,"Aprobado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
//Envios
|
||||
|
||||
$sql = 'INSERT INTO envio (sucursalId, fecha, usuarioId, fechaRecibido, userIdRecibido, tipo, status)
|
||||
VALUES ("'.$sucursalId.'","'.date('Y-m-d H:i:s').'", 4, "'.date('Y-m-d H:i:s').'", 5, "CT", "Recibido")';
|
||||
$db->setQuery($sql);
|
||||
$envioId = $db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioPedido (envioId, pedidoId, noCajas)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioRecibir (envioId, pedidoId, productoId, noPrendas, completo)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$productoId.'", "'.$cantidad.'", "1")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
for($k=0; $k<$cantidad; $k++){
|
||||
|
||||
$sql = 'INSERT INTO inventario (envioId, pedidoId, sucursalId, productoId, prodItemId, precioVenta, cantidad, status)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$sucursalId.'", "'.$productoId.'", "'.$productoId.'", "'.$infP['precioVentaIva'].'", "1", "Disponible")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
}
|
||||
|
||||
//Guardamos los Datos
|
||||
|
||||
$sql = 'INSERT INTO ajustes (sucursalId, productoId, disponible, cantidad, fecha, pedidoId, usuarioId,
|
||||
tipo, modulo)
|
||||
VALUES ("'.$sucursalId.'", "'.$productoId.'", "'.$disponible.'", "'.$cantidad.'",
|
||||
"'.date('Y-m-d H:i:s').'", "'.$pedidoId.'", "'.$Usr['usuarioId'].'", "Agregar", "EnvMercFS")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$util->setError(20109,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
}//if
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$envio->setSucursalId(0);
|
||||
$productos = $envio->EnumRepProd();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($card['tipo'] == 'Faltante')
|
||||
$card['recibido'] = $card['total'] - $card['cantidad'];
|
||||
else
|
||||
$card['recibido'] = $card['total'] + $card['cantidad'];
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-productos-recibidos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'rechazarProducto':
|
||||
|
||||
$envio->setEnvRepProdId($_POST['envRepProdId']);
|
||||
|
||||
if(!$envio->RechazarRepProd())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$productos = $envio->EnumRepProd();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($card['tipo'] == 'Faltante')
|
||||
$card['recibido'] = $card['total'] - $card['cantidad'];
|
||||
else
|
||||
$card['recibido'] = $card['total'] + $card['cantidad'];
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-productos-recibidos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'loadInfoProd':
|
||||
|
||||
$envioId = $_POST['envioId'];
|
||||
$codigoBarra = $_POST['codigoBarra'];
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo2();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$infE = $envio->Info();
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$envio->setProductoId($productoId);
|
||||
|
||||
if($infE['tipo'] == 'CT')
|
||||
$total = $envio->GetTotalProdsRec();
|
||||
else
|
||||
$total = $envio->GetTotalProdsRecTT();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo utf8_encode($infP['modelo']);
|
||||
echo '[#]';
|
||||
echo number_format($total,0,'.',',');
|
||||
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
|
||||
$codigoBarra = trim($_POST['codigoBarra2']);
|
||||
|
||||
if($codigoBarra){
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo();
|
||||
}
|
||||
|
||||
$envio->setEnvioId(trim($_POST['envioId2']));
|
||||
$envio->setSucursalId($_POST['sucursalId2']);
|
||||
$envio->setProductoId($productoId);
|
||||
$envio->setStatus($_POST['status2']);
|
||||
$productos = $envio->SearchRepProd();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$card['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($card['tipo'] == 'Faltante')
|
||||
$card['recibido'] = $card['total'] - $card['cantidad'];
|
||||
else
|
||||
$card['recibido'] = $card['total'] + $card['cantidad'];
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-productos-recibidos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
86
ajax/envios-reporte.php
Executable file
86
ajax/envios-reporte.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST['type']){
|
||||
|
||||
case 'search':
|
||||
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
$fechaRec = $_POST['fechaEnvio2'];
|
||||
|
||||
if(!$sucursalId){
|
||||
$util->setError(30015,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaRec == ''){
|
||||
$util->setError(20099,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$fechaRec = date('Y-m-d',strtotime($fechaRec));
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$nomSuc = urldecode($sucursal->GetNameById());
|
||||
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$inventario->setFecha($fechaRec);
|
||||
$resProds = $inventario->GetSingleProds();
|
||||
|
||||
$cantTotal = 0;
|
||||
$impTotal = 0;
|
||||
|
||||
$productos = array();
|
||||
foreach($resProds as $res){
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$info = $producto->Info();
|
||||
|
||||
$res['codigoBarra'] = $info['codigoBarra'];
|
||||
$res['modelo'] = utf8_encode($info['modelo']);
|
||||
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$inventario->setProductoId($res['productoId']);
|
||||
$inventario->setFecha($fechaRec);
|
||||
$res['cantidad'] = $inventario->GetCantByProd();
|
||||
|
||||
$res['precio'] = $info['precioVentaIva'];
|
||||
$res['importe'] = $res['cantidad'] * $res['precio'];
|
||||
|
||||
$cantTotal += $res['cantidad'];
|
||||
$impTotal += $res['importe'];
|
||||
|
||||
$productos[] = $res;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('fechaRec', $fechaRec);
|
||||
$smarty->assign('impTotal', $impTotal);
|
||||
$smarty->assign('cantTotal', $cantTotal);
|
||||
$smarty->assign('nomSuc', $nomSuc);
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-reporte.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
93
ajax/envios-transito.php
Executable file
93
ajax/envios-transito.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST['type']){
|
||||
|
||||
case 'search':
|
||||
|
||||
$sucursalId2 = $_POST['sucursalId2'];
|
||||
$proveedorId2 = $_POST['proveedorId2'];
|
||||
|
||||
if($_POST['fechaIni2'])
|
||||
$fechaIni = date('Y-m-d',strtotime($_POST['fechaIni2']));
|
||||
if($_POST['fechaFin2'])
|
||||
$fechaFin = date('Y-m-d',strtotime($_POST['fechaFin2']));
|
||||
|
||||
$envio->setFechaIni($fechaIni);
|
||||
$envio->setFechaFin($fechaFin);
|
||||
$envio->setSucursalId($sucursalId2);
|
||||
$envios = $envio->GetEnviosTransito();
|
||||
|
||||
$cantTotal = 0;
|
||||
$productos = array();
|
||||
foreach($envios as $res){
|
||||
|
||||
$envioId = $res['envioId'];
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$nomSuc = urldecode($sucursal->GetNameById());
|
||||
|
||||
$envio->setEnvioId($envioId);
|
||||
$pedidos = $envio->GetPedidosByEnvio();
|
||||
|
||||
foreach($pedidos as $val){
|
||||
|
||||
$pedidoId = $val['pedidoId'];
|
||||
|
||||
$envio->setPedidoId($pedidoId);
|
||||
$envio->setSucursalId($sucursalId);
|
||||
$resProds = $envio->GetProductos2();
|
||||
|
||||
foreach($resProds as $prod){
|
||||
|
||||
$productoId = $prod['productoId'];
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infP = $producto->Info();
|
||||
|
||||
if($proveedorId2){
|
||||
if($proveedorId2 != $infP['proveedorId'])
|
||||
continue;
|
||||
}
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$card['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$card['cantidad'] = $prod['cantidad'];
|
||||
$card['sucursal'] = $nomSuc;
|
||||
$card['modelo'] = utf8_encode($infP['modelo']);
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['envioId'] = $envioId;
|
||||
$card['fecha'] = $res['fecha'];
|
||||
|
||||
$cantTotal += $card['cantidad'];
|
||||
|
||||
$productos[] = $card;
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('cantTotal', $cantTotal);
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/envios-transito.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
1046
ajax/envios.php
Executable file
1046
ajax/envios.php
Executable file
File diff suppressed because it is too large
Load Diff
518
ajax/evaluar-pedidos.php
Executable file
518
ajax/evaluar-pedidos.php
Executable file
@@ -0,0 +1,518 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
$p = $_SESSION['edpP'];
|
||||
$projectId = $_SESSION['curProjId'];
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'suggestBonificacion':
|
||||
$bonificacion->setPedidoId($_POST['search1']);
|
||||
$bonificacion->setSearch($_POST['search2']);
|
||||
$bonificacion->setStatus($_POST['filtraStatus']);
|
||||
|
||||
$bonificaciones = $bonificacion->EnumerateSearch();
|
||||
|
||||
//$bonificaciones = $bonificacion->Enumerate();
|
||||
|
||||
foreach($bonificaciones['items'] as $key => $productosBonificacion)
|
||||
{
|
||||
$proveedor->setProveedorId($productosBonificacion['proveedorId']);
|
||||
$bonificaciones['items'][$key]['nombreProveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$bonificacion->setProductoId($productosBonificacion['productoId']);
|
||||
$bonificacion->setPedidoId($productosBonificacion['pedidoId']);
|
||||
$resP = $bonificacion->searchProductoById();
|
||||
|
||||
$producto->setProductoId($productosBonificacion['productoId']);
|
||||
$infoProd = $producto->Info();
|
||||
|
||||
/* $atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());*/
|
||||
//echo $productosBonificacion['totalProductos']."***".$productosBonificacion['costoProducto']."<br>";
|
||||
$bonificaciones['items'][$key]['nombreProducto'] = $infoProd['modelo'];//$productosBonificacion['modelo'];//.' '.$talla.' '.$color;
|
||||
$bonificaciones['items'][$key]['codigoBarra'] = $infoProd['codigoBarra'];
|
||||
$bonificaciones['items'][$key]['costoTotal'] = $productosBonificacion['totalProductos']*$productosBonificacion['costoProducto'];
|
||||
$bonificaciones['items'][$key]['costoTotalVendido'] = $productosBonificacion['vendido']*$productosBonificacion['costoProducto'];
|
||||
@$bonificaciones['items'][$key]['porcentajeUtilidad'] = ($bonificaciones['items'][$key]['costoTotal']-$bonificaciones['items'][$key]['costoTotalVendido'])/$bonificaciones['items'][$key]['costoTotalVendido'];
|
||||
if($bonificaciones['items'][$key]['costoTotal'] > $bonificaciones['items'][$key]['costoTotalVendido'])
|
||||
$bonificaciones['items'][$key]['porcentajeUtilidad'] = "-".$bonificaciones['items'][$key]['porcentajeUtilidad'];
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
|
||||
$bonificacion->setPedidoId($_POST['search1']);
|
||||
$bonificacion->setSearch($_POST['search2']);
|
||||
$bonificacion->setStatus($_POST['filtraStatus']);
|
||||
$resPedidos = $bonificacion->GetPedidos();
|
||||
//print_r($resPedidos);
|
||||
foreach($resPedidos as $key => $resPedido)
|
||||
{
|
||||
$evaluacion->setPedidoId($resPedido['pedidoId']);
|
||||
$proveedor->setProveedorId($resPedido['proveedorId']);
|
||||
$resPedidos[$key]['compraFirme'] = $proveedor->GetCompraFirme();
|
||||
$totalBonificaciones = $evaluacion->getTotalBonificaciones();
|
||||
$totalDevoluciones = $evaluacion->getTotalDevoluciones();
|
||||
$resPedidos[$key]["totalBonificacion"] = $totalBonificaciones;
|
||||
$resPedidos[$key]["totalDevolucion"] = $totalDevoluciones;
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
$bonificaciones['items'] = $bonificacion->Util()->EncodeResult($bonificaciones['items']);
|
||||
$resPedidos = $bonificacion->Util()->EncodeResult($resPedidos);
|
||||
echo "ok[#]";
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
$smarty->assign('resPedidos', $resPedidos);
|
||||
$smarty->assign('pedidoStatus',$_POST['filtraStatus']);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/bonificaciones-pendientes.tpl');
|
||||
break;
|
||||
case 'cambiarStatus':
|
||||
|
||||
//$bonificacionId = $_POST['bonificacionId'];
|
||||
//$justificante = $_POST['justificante'];
|
||||
//$aux = $_POST['aux'];
|
||||
|
||||
/*if($status == "Rechazado" && $aux == 1)
|
||||
{
|
||||
$smarty->assign('status', $status);
|
||||
$smarty->assign('bonificacionId', $bonificacionId);
|
||||
echo 'Rechazo[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/justificar-rechazo-bonificacion.tpl');
|
||||
exit(0);
|
||||
}*/
|
||||
|
||||
//$bonificacion->setBonificacionId($bonificacionId);
|
||||
$bonificacion->setPedidoId($_POST['pedidoId']);
|
||||
$bonificacion->setTotalDevolucion($_POST['totalDevolucion']);
|
||||
$bonificacion->setTotalBonificacion($_POST['totalBonificacion']);
|
||||
//$bonificacion->setCantidad($totalBonificacion);
|
||||
/*if($status == "Rechazado")
|
||||
$bonificacion->setJustificanteRechazo($justificante);*/
|
||||
|
||||
if(!$bonificacion->updateStatus())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
$bonificaciones = $bonificacion->Enumerate();
|
||||
|
||||
foreach($bonificaciones['items'] as $key => $productosBonificacion)
|
||||
{
|
||||
$proveedor->setProveedorId($productosBonificacion['proveedorId']);
|
||||
$bonificaciones['items'][$key]['nombreProveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$bonificacion->setProductoId($productosBonificacion['productoId']);
|
||||
$bonificacion->setPedidoId($productosBonificacion['pedidoId']);
|
||||
$resP = $bonificacion->searchProductoById();
|
||||
|
||||
$producto->setProductoId($productosBonificacion['productoId']);
|
||||
$infoProd = $producto->Info();
|
||||
|
||||
/* $atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());*/
|
||||
//echo $productosBonificacion['totalProductos']."***".$productosBonificacion['costoProducto']."<br>";
|
||||
$bonificaciones['items'][$key]['nombreProducto'] = $infoProd['modelo'];//$productosBonificacion['modelo'];//.' '.$talla.' '.$color;
|
||||
$bonificaciones['items'][$key]['codigoBarra'] = $infoProd['codigoBarra'];
|
||||
$bonificaciones['items'][$key]['costoTotal'] = $productosBonificacion['totalProductos']*$productosBonificacion['costoProducto'];
|
||||
$bonificaciones['items'][$key]['costoTotalVendido'] = $productosBonificacion['vendido']*$productosBonificacion['costoProducto'];
|
||||
@$bonificaciones['items'][$key]['porcentajeUtilidad'] = ($bonificaciones['items'][$key]['costoTotal']-$bonificaciones['items'][$key]['costoTotalVendido'])/$bonificaciones['items'][$key]['costoTotalVendido'];
|
||||
if($bonificaciones['items'][$key]['costoTotal'] > $bonificaciones['items'][$key]['costoTotalVendido'])
|
||||
$bonificaciones['items'][$key]['porcentajeUtilidad'] = "-".$bonificaciones['items'][$key]['porcentajeUtilidad'];
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
|
||||
$resPedidos = $evaluacion->GetPedidos();
|
||||
//print_r($resPedidos);
|
||||
foreach($resPedidos as $key => $resPedido)
|
||||
{
|
||||
$evaluacion->setPedidoId($resPedido['pedidoId']);
|
||||
$proveedor->setProveedorId($resPedido['proveedorId']);
|
||||
$resPedidos[$key]['compraFirme'] = $proveedor->GetCompraFirme();
|
||||
$totalBonificaciones = $evaluacion->getTotalBonificaciones();
|
||||
$totalDevoluciones = $evaluacion->getTotalDevoluciones();
|
||||
$resPedidos[$key]["totalBonificacion"] = $totalBonificaciones;
|
||||
$resPedidos[$key]["totalDevolucion"] = $totalDevoluciones;
|
||||
}
|
||||
|
||||
$smarty->assign('resPedidos', $resPedidos);
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
$bonificaciones['items'] = $bonificacion->Util()->EncodeResult($bonificaciones['items']);
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/bonificaciones-pendientes.tpl');
|
||||
}
|
||||
break;
|
||||
case 'addPago':
|
||||
$menuBon = $_POST['menu'];
|
||||
$ids = $_POST['id'];
|
||||
//{$it.productoId}##{$it.prodItemId}##{$item.pedidoId}##{$item.proveedorId}
|
||||
$ids = split("##", $ids);
|
||||
|
||||
$productoId = $ids[0];
|
||||
$prodItemId = $ids[1];
|
||||
$pedidoId = $ids[2];
|
||||
$proveedorId = $ids[3];
|
||||
|
||||
$costo = $ids[4];
|
||||
$total = $ids[5];
|
||||
$disponible = $ids[6];
|
||||
$vendido = $ids[7];
|
||||
$porcentajeVendido = $ids[8];
|
||||
$porcentajeAplicado = $ids[9];
|
||||
$pagoTotal = $ids[10];
|
||||
|
||||
$evaluacion->setPedidoId($pedidoId);
|
||||
|
||||
$infoPro = $evaluacion->InfoPedidoProveedor();
|
||||
|
||||
$evaluacion->setProdItemId($prodItemId);
|
||||
//echo "<br>";
|
||||
$producto = $evaluacion->searchProductoById();
|
||||
|
||||
//print_r($producto);// exit(0);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('prodItemId', $prodItemId);
|
||||
$smarty->assign('pedidoId', $pedidoId);
|
||||
$smarty->assign('proveedorId', $proveedorId);
|
||||
|
||||
$smarty->assign('costo', $costo);
|
||||
$smarty->assign('total', $total);
|
||||
$smarty->assign('disponible', $disponible);
|
||||
$smarty->assign('vendido', $vendido);
|
||||
$smarty->assign('porcentajeVendido', $porcentajeVendido);
|
||||
$smarty->assign('porcentajeAplicado', $porcentajeAplicado);
|
||||
$smarty->assign('pagoTotal', $pagoTotal);
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-bonificacion-popup.tpl');
|
||||
break;
|
||||
|
||||
case 'saveAddPago':
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$prodItemId = $_POST['prodItemId'];
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
|
||||
$costo = $_POST['costo'];
|
||||
$total = $_POST['total'];
|
||||
$disponible = $_POST['disponible'];
|
||||
$vendido = $_POST['vendido'];
|
||||
$porcentajeVendido = $_POST['porcentajeVendido'];
|
||||
$porcentajeAplicado = $_POST['porcentajeAplicado'];
|
||||
$pagoTotal = $_POST['pagoTotal'];
|
||||
|
||||
$porcentajeBonifica = $_POST['bonificacion'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
$restante = $pagoTotal - $cantidad;
|
||||
|
||||
$bonificacion->setProdItemId($prodItemId);
|
||||
$bonificacion->setProveedorId($proveedorId);
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPorcentajeBonifica($porcentajeBonifica);
|
||||
$bonificacion->setPagoTotal($pagoTotal);
|
||||
$bonificacion->setRestante($restante);
|
||||
$bonificacion->setPorcentajeAplicado($porcentajeAplicado);
|
||||
$bonificacion->setTotal($total);
|
||||
$bonificacion->setCosto($costo);
|
||||
$bonificacion->setDisponible($disponible);
|
||||
$bonificacion->setVendido($vendido);
|
||||
$bonificacion->setPorcentajeVendido($porcentajeVendido);
|
||||
$bonificacion->setCantidad($cantidad);
|
||||
|
||||
//exit(0);
|
||||
if(!$bonificacion->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
/////////////
|
||||
$evaluarPedidos = $evaluacion->Enumerate();
|
||||
|
||||
$rfc->setRfcId("1");
|
||||
$rfcInfo = $rfc->Info();
|
||||
$items = array();
|
||||
$politicas = $politica->EnumerateAll();
|
||||
|
||||
foreach($evaluarPedidos['items'] as $res)
|
||||
{
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
$proveedorInfo = $proveedor->Info();
|
||||
$porcentajeBonifProveedor = $proveedorInfo['bonificacion'];
|
||||
|
||||
$evaluacion->setPedidoId($res['pedidoId']);
|
||||
$evaluacion->setPlazo($res['plazo']);
|
||||
$evaluacion->setFecha($res['fechaEntrega']);
|
||||
$evaluacion->setBonificacion($res['bonificacion']);
|
||||
|
||||
if($evaluacion->evaluar())
|
||||
{
|
||||
$productosRes = $evaluacion->searchProductos();
|
||||
$productosR = array();
|
||||
|
||||
foreach($productosRes as $resP)
|
||||
{
|
||||
// print_r($resP); exit(0);
|
||||
|
||||
$bonificacion->setProdItemId($resP['prodItemId']);
|
||||
$bonificacion->setProveedorId($resP['proveedorId']);
|
||||
$bonificacion->setPedidoId($resP['pedidoId']);
|
||||
$bonificacion->setProductoId($resP['productoId']);
|
||||
|
||||
if($bonificacion->checkBonificacion())
|
||||
{
|
||||
$atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$evaluacion->setProdItemId($resP['prodItemId']);
|
||||
|
||||
$resP['disponible'] = $evaluacion->GetDisponible();
|
||||
$resP['total'] = $evaluacion->GetTotalProductosPedido();
|
||||
$resP['vendido'] = $evaluacion->GetTotalVendidos();
|
||||
$resP['porcentajeVendido'] = $evaluacion->evaluarVentas();
|
||||
|
||||
$resP['costoTotal'] = $resP['total']*$resP['costo'];
|
||||
foreach($politicas as $key => $politica)
|
||||
{
|
||||
$porcentaje1 = $politicas[$key]['porcentajeEvaluacion'];
|
||||
if(isset($politicas[$key+1]['porcentajeEvaluacion']))
|
||||
$porcentaje2 = $politicas[$key+1]['porcentajeEvaluacion'];
|
||||
else
|
||||
$porcentaje2 = 0;
|
||||
|
||||
if($resP['porcentajeVendido'] <= $porcentaje1 && $resP['porcentajeVendido'] > $porcentaje2)
|
||||
{
|
||||
//$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$porcentajeBonifProveedor)/100);
|
||||
$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$politicas[$key]['porcentajeBonificacion'])/100);
|
||||
$resP['porcentajeAplicado'] = $politicas[$key]['porcentajeBonificacion'];//$politica['porcentajeBonificacion'];
|
||||
if($politica['tipo'] == "Devolucion")
|
||||
{
|
||||
$resP['costoDevolucion'] = $resP['disponible']*$resP['costo'];
|
||||
$resP['costoBonificacion'] = "";
|
||||
$resP['porcentajeAplicado'] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resP['nombre'] = $resP['modelo'].' '.$talla.' '.$color;
|
||||
|
||||
$productosR[] = $resP;
|
||||
}
|
||||
}
|
||||
$res['productos'] = $productosR;
|
||||
$items[] = $res;
|
||||
}
|
||||
}
|
||||
$evaluarPedidos['items'] = $items;
|
||||
|
||||
$smarty->assign('rfcInfo',$rfcInfo);
|
||||
|
||||
$smarty->assign('msg', $msg);
|
||||
$smarty->assign('evaluarPedidos', $evaluarPedidos);
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/evaluar-pedidos.tpl');
|
||||
|
||||
/*$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');*/
|
||||
}
|
||||
break;
|
||||
case 'saveDevolucion':
|
||||
$ids = $_POST['id'];
|
||||
//{$it.productoId}##{$it.prodItemId}##{$item.pedidoId}##{$item.proveedorId}
|
||||
$ids = split("##", $ids);
|
||||
|
||||
$productoId = $ids[0];
|
||||
$prodItemId = $ids[1];
|
||||
$pedidoId = $ids[2];
|
||||
$proveedorId = $ids[3];
|
||||
|
||||
$costo = $ids[4];
|
||||
$total = $ids[5];
|
||||
$disponible = $ids[6];
|
||||
$vendido = $ids[7];
|
||||
$porcentajeVendido = $ids[8];
|
||||
$porcentajeAplicado = $ids[9];
|
||||
$pagoTotal = $ids[10];
|
||||
|
||||
$porcentajeBonifica = $_POST['bonificacion'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
$restante = $pagoTotal - $cantidad;
|
||||
|
||||
$bonificacion->setProdItemId($prodItemId);
|
||||
$bonificacion->setProveedorId($proveedorId);
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPorcentajeBonifica($porcentajeBonifica);
|
||||
$bonificacion->setPagoTotal($pagoTotal);
|
||||
$bonificacion->setRestante($restante);
|
||||
$bonificacion->setPorcentajeAplicado($porcentajeAplicado);
|
||||
$bonificacion->setTotal($total);
|
||||
$bonificacion->setCosto($costo);
|
||||
$bonificacion->setDisponible($disponible);
|
||||
$bonificacion->setVendido($vendido);
|
||||
$bonificacion->setPorcentajeVendido($porcentajeVendido);
|
||||
$bonificacion->setCantidad($cantidad);
|
||||
|
||||
//exit(0);
|
||||
if(!$bonificacion->SaveDevolucion())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
/////////////
|
||||
$evaluarPedidos = $evaluacion->Enumerate();
|
||||
|
||||
$rfc->setRfcId("1");
|
||||
$rfcInfo = $rfc->Info();
|
||||
$items = array();
|
||||
$politicas = $politica->EnumerateAll();
|
||||
|
||||
foreach($evaluarPedidos['items'] as $res)
|
||||
{
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
$proveedorInfo = $proveedor->Info();
|
||||
$porcentajeBonifProveedor = $proveedorInfo['bonificacion'];
|
||||
|
||||
$evaluacion->setPedidoId($res['pedidoId']);
|
||||
$evaluacion->setPlazo($res['plazo']);
|
||||
$evaluacion->setFecha($res['fechaEntrega']);
|
||||
$evaluacion->setBonificacion($res['bonificacion']);
|
||||
|
||||
if($evaluacion->evaluar())
|
||||
{
|
||||
$productosRes = $evaluacion->searchProductos();
|
||||
$productosR = array();
|
||||
|
||||
foreach($productosRes as $resP)
|
||||
{
|
||||
// print_r($resP); exit(0);
|
||||
|
||||
$bonificacion->setProdItemId($resP['prodItemId']);
|
||||
$bonificacion->setProveedorId($resP['proveedorId']);
|
||||
$bonificacion->setPedidoId($resP['pedidoId']);
|
||||
$bonificacion->setProductoId($resP['productoId']);
|
||||
|
||||
if($bonificacion->checkBonificacion())
|
||||
{
|
||||
$atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$evaluacion->setProdItemId($resP['prodItemId']);
|
||||
|
||||
$resP['disponible'] = $evaluacion->GetDisponible();
|
||||
$resP['total'] = $evaluacion->GetTotalProductosPedido();
|
||||
$resP['vendido'] = $evaluacion->GetTotalVendidos();
|
||||
$resP['porcentajeVendido'] = $evaluacion->evaluarVentas();
|
||||
|
||||
$resP['costoTotal'] = $resP['total']*$resP['costo'];
|
||||
foreach($politicas as $key => $politica)
|
||||
{
|
||||
$porcentaje1 = $politicas[$key]['porcentajeEvaluacion'];
|
||||
if(isset($politicas[$key+1]['porcentajeEvaluacion']))
|
||||
$porcentaje2 = $politicas[$key+1]['porcentajeEvaluacion'];
|
||||
else
|
||||
$porcentaje2 = 0;
|
||||
|
||||
if($resP['porcentajeVendido'] <= $porcentaje1 && $resP['porcentajeVendido'] > $porcentaje2)
|
||||
{
|
||||
//$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$porcentajeBonifProveedor)/100);
|
||||
$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$politicas[$key]['porcentajeBonificacion'])/100);
|
||||
$resP['porcentajeAplicado'] = $politicas[$key]['porcentajeBonificacion'];//$politica['porcentajeBonificacion'];
|
||||
if($politica['tipo'] == "Devolucion")
|
||||
{
|
||||
$resP['costoDevolucion'] = $resP['disponible']*$resP['costo'];
|
||||
$resP['costoBonificacion'] = "";
|
||||
$resP['porcentajeAplicado'] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resP['nombre'] = $resP['modelo'].' '.$talla.' '.$color;
|
||||
|
||||
$productosR[] = $resP;
|
||||
}
|
||||
}
|
||||
$res['productos'] = $productosR;
|
||||
$items[] = $res;
|
||||
}
|
||||
}
|
||||
$evaluarPedidos['items'] = $items;
|
||||
|
||||
$smarty->assign('rfcInfo',$rfcInfo);
|
||||
|
||||
$smarty->assign('msg', $msg);
|
||||
$smarty->assign('evaluarPedidos', $evaluarPedidos);
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/evaluar-pedidos.tpl');
|
||||
|
||||
/*$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
265
ajax/facturacion-folios.php
Executable file
265
ajax/facturacion-folios.php
Executable file
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$empresaId = $_SESSION['empresaId'];
|
||||
|
||||
switch($_POST['type']){
|
||||
|
||||
case 'addFolios':
|
||||
|
||||
$rfcId = 1;
|
||||
|
||||
$comprobantes = $main->ListTiposDeComprobantes();
|
||||
$comprobantes = $util->EncodeResult($comprobantes);
|
||||
|
||||
$ruta_dir = DOC_ROOT.'/empresas/'.$empresaId.'/certificados/'.$rfcId;
|
||||
|
||||
if(is_dir($ruta_dir)){
|
||||
if($gd = opendir($ruta_dir)){
|
||||
while($archivo = readdir($gd)){
|
||||
$info = pathinfo($ruta_dir.'/'.$archivo);
|
||||
if($info['extension'] == 'cer'){
|
||||
$nom_certificado = $info['filename'];
|
||||
break;
|
||||
}//if
|
||||
}//while
|
||||
closedir($gd);
|
||||
}//if
|
||||
}//if
|
||||
|
||||
$info = $user->Info();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('comprobantes', $comprobantes);
|
||||
$smarty->assign('nom_certificado', $nom_certificado);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-facturacion-folios-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveFolios':
|
||||
|
||||
$info = $user->Info();
|
||||
|
||||
$rfcId = 1;
|
||||
|
||||
$folios->setIdRfc($rfcId);
|
||||
$folios->setIdEmpresa($empresaId);
|
||||
$folios->setSerie($_POST['serie']);
|
||||
$folios->setFolioInicial($_POST['folio_inicial']);
|
||||
$folios->setFolioFinal($_POST['folio_final']);
|
||||
|
||||
if($info["version"] == "v3" || $info["version"] == "construc")
|
||||
{
|
||||
$folios->setComprobante($_POST['comprobante']);
|
||||
$folios->setNoCertificado($_POST['no_certificado']);
|
||||
$folios->setEmail($_POST['email']);
|
||||
}
|
||||
elseif($info["version"] == "auto")
|
||||
{
|
||||
$fecha = $values[4][1]."/".$values[5][1]."/".$values[6][1]." ".$values[7][1].":".$values[8][1].":".$values[9][1];
|
||||
$folios->setNoAprobacion($values[3][1]);
|
||||
$folios->setComprobante($values[10][1]);
|
||||
$folios->setLugarExpedicion($values[11][1]);
|
||||
$folios->setNoCertificado($fecha);
|
||||
$folios->setEmail($values[12][1]);
|
||||
}
|
||||
|
||||
|
||||
if(!$folios->AddFolios()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->assign('folios', $folios->GetFoliosByRfc());
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion-folios.tpl');
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case 'editFolios':
|
||||
|
||||
$rfcId = 1;
|
||||
|
||||
$sucursal->setRfcId($rfcId);
|
||||
$resSucursales = $sucursal->GetSucursalesByRfc();
|
||||
$sucursales = $util->DecodeUrlResult($resSucursales);
|
||||
|
||||
$comprobantes = $main->ListTiposDeComprobantes();
|
||||
$comprobantes = $util->EncodeResult($comprobantes);
|
||||
|
||||
$ruta_dir = DOC_ROOT.'/empresas/'.$empresaId.'/certificados/'.$rfcId;
|
||||
|
||||
if(is_dir($ruta_dir)){
|
||||
if($gd = opendir($ruta_dir)){
|
||||
while($archivo = readdir($gd)){
|
||||
$info = pathinfo($ruta_dir.'/'.$archivo);
|
||||
if($info['extension'] == 'cer'){
|
||||
$nom_certificado = $info['filename'];
|
||||
break;
|
||||
}//if
|
||||
}//while
|
||||
closedir($gd);
|
||||
}//if
|
||||
}//if
|
||||
|
||||
$folios->setFoliosDelete($_POST['id_serie']);
|
||||
$infoFolios = $folios->getInfoFolios();
|
||||
|
||||
$infoUser = $user->Info();
|
||||
if($infoUser["version"] == "auto")
|
||||
{
|
||||
$fecha = explode(" ", $infoFolios["noCertificado"]);
|
||||
$fechaDate = explode("/", $fecha[0]);
|
||||
$fechaTime = explode(":", $fecha[1]);
|
||||
$fecha = array_merge($fechaDate, $fechaTime);
|
||||
$smarty->assign('fecha', $fecha);
|
||||
}
|
||||
|
||||
//logo
|
||||
$ruta_dir = DOC_ROOT.'/empresas/'.$empresaId.'/qrs';
|
||||
$ruta_web_dir = WEB_ROOT.'/empresas/'.$empresaId.'/qrs';
|
||||
if(is_dir($ruta_dir)){
|
||||
if($gd = opendir($ruta_dir)){
|
||||
while($archivo = readdir($gd)){
|
||||
$serie = explode(".", $archivo);
|
||||
if($serie[0] == $_POST['id_serie'])
|
||||
{
|
||||
$qr = $ruta_web_dir.'/'.$archivo;
|
||||
break;
|
||||
}
|
||||
}//while
|
||||
closedir($gd);
|
||||
}//if
|
||||
}//if
|
||||
|
||||
$smarty->assign('qr', $qr);
|
||||
$smarty->assign('info', $infoFolios);
|
||||
$smarty->assign('infoUser', $infoUser);
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign('comprobantes', $comprobantes);
|
||||
$smarty->assign('nom_certificado', $nom_certificado);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-facturacion-folios-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditFolios':
|
||||
|
||||
$info = $user->Info();
|
||||
|
||||
$rfcId = 1;
|
||||
|
||||
$folios->setIdRfc($rfcId);
|
||||
$folios->setIdEmpresa($empresaId);
|
||||
$folios->setSerie($_POST['serie']);
|
||||
$folios->setFolioInicial($_POST['folio_inicial']);
|
||||
$folios->setFolioFinal($_POST['folio_final']);
|
||||
|
||||
if($info["version"] == "v3" || $info["version"] == "construc")
|
||||
{
|
||||
$folios->setComprobante($_POST['comprobante']);
|
||||
$folios->setLugarExpedicion($_POST['lugar_expedicion']);
|
||||
$folios->setNoCertificado($_POST['no_certificado']);
|
||||
$folios->setEmail($_POST['email']);
|
||||
$folios->setIdSerie($_POST['id_serie']);
|
||||
}
|
||||
elseif($info["version"] == "auto")
|
||||
{
|
||||
$folios->setNoAprobacion($values[3][1]);
|
||||
|
||||
//juntar fecha
|
||||
$fecha = $values[4][1]."/".$values[5][1]."/".$values[6][1]." ".$values[7][1].":".$values[8][1].":".$values[9][1];
|
||||
$folios->setComprobante($values[10][1]);
|
||||
$folios->setLugarExpedicion($values[11][1]);
|
||||
$folios->setNoCertificado($fecha);
|
||||
$folios->setEmail($values[12][1]);
|
||||
$folios->setIdSerie($values[13][1]);
|
||||
}
|
||||
|
||||
if(!$folios->EditFolios()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->assign('folios', $folios->GetFoliosByRfc());
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion-folios.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteFolios':
|
||||
|
||||
$rfcId = 1;
|
||||
$serieId = $_POST['id_serie'];
|
||||
|
||||
$folios->setIdRfc($rfcId);
|
||||
$folios->setFoliosDelete($serieId);
|
||||
|
||||
if($folios->DeleteFolios()){
|
||||
|
||||
//Eliminamos los archivos QR
|
||||
|
||||
$file = DOC_ROOT.'/empresas/'.$empresaId.'/qrs/'.$serieId.'.jpg';
|
||||
@unlink($file);
|
||||
|
||||
$info = $user->Info();
|
||||
$listFolios = $folios->GetFoliosByRfc();
|
||||
|
||||
echo 'Ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$smarty->assign('folios', $listFolios);
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion-folios.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteLogo':
|
||||
|
||||
$rfcId = 1;
|
||||
$serieId = $_POST['serieId'];
|
||||
|
||||
$folios->setIdRfc($rfcId);
|
||||
$folios->setFoliosDelete($serieId);
|
||||
|
||||
//Eliminamos los archivos QR
|
||||
|
||||
$file = DOC_ROOT.'/empresas/'.$empresaId.'/qrs/'.$serieId.'.jpg';
|
||||
@unlink($file);
|
||||
|
||||
$util->setError(20090,'complete','','');
|
||||
$util->PrintErrors();
|
||||
|
||||
$info = $user->Info();
|
||||
$listFolios = $folios->GetFoliosByRfc();
|
||||
|
||||
echo 'Ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$smarty->assign('folios', $listFolios);
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion-folios.tpl');
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
157
ajax/facturacion-nueva.php
Executable file
157
ajax/facturacion-nueva.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$empresaId = $_SESSION['empresaId'];
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
switch($_POST['type']){
|
||||
|
||||
case "agregarConcepto":
|
||||
|
||||
$valorUnitario = $_POST['valorUnitario'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
$importe = $valorUnitario * $cantidad;
|
||||
$importe = number_format($importe,2,'.','');
|
||||
|
||||
$producto->setProductoId($_POST['productoId']);
|
||||
$producto->setCantidad($cantidad);
|
||||
$producto->setNoIdentificacion($_POST['noIdentificacion']);
|
||||
$producto->setUnidad($_POST['unidad']);
|
||||
$producto->setDescripcion($_POST['descripcion']);
|
||||
$producto->setValorUnitario($valorUnitario);
|
||||
$producto->setExcentoIva($_POST['excentoIva']);
|
||||
$producto->setImporte($importe);
|
||||
|
||||
if(!$producto->AgregarConceptoFact())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "[#]";
|
||||
}
|
||||
|
||||
$smarty->assign("conceptos", $_SESSION["conceptos"]);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos-facturacion.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "borrarConcepto":
|
||||
|
||||
$k = $_POST['id'];
|
||||
|
||||
$conceptos = $_SESSION['conceptos'];
|
||||
unset($conceptos[$k]);
|
||||
$_SESSION['conceptos'] = $conceptos;
|
||||
|
||||
$smarty->assign("conceptos", $conceptos);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/conceptos-facturacion.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "updateTotalesDesglosados":
|
||||
|
||||
$totalDesglosado = $producto->GetTotalDesglosado();
|
||||
unset($totalDesglosado["impuestos"]);
|
||||
|
||||
if($totalDesglosado){
|
||||
foreach($totalDesglosado as $key => $total)
|
||||
{
|
||||
$totalDesglosado[$key] = number_format($totalDesglosado[$key], 2);
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("totalDesglosado", $totalDesglosado);
|
||||
$smarty->assign("impuestos", $totalDesglosado["impuestos"]);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/total-desglosado.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "generarComprobante":
|
||||
|
||||
$data["datosFacturacion"] = $_POST["nuevaFactura"];
|
||||
$data["observaciones"] = $_POST["observaciones"];
|
||||
|
||||
if(!$comprobante->GenerarComprobante($data))
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$info = $user->Info();
|
||||
$comprobante = $comprobante->GetLastComprobante();
|
||||
|
||||
$smarty->assign("info", $info);
|
||||
$smarty->assign("comprobante", $comprobante);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/export-factura.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "vistaPreviaComprobante":
|
||||
|
||||
$data["datosFacturacion"] = $_POST["nuevaFactura"];
|
||||
$data["observaciones"] = $_POST["observaciones"];
|
||||
|
||||
$data["reviso"] = $_POST["reviso"];
|
||||
$data["autorizo"] = $_POST["autorizo"];
|
||||
$data["recibio"] = $_POST["recibio"];
|
||||
$data["vobo"] = $_POST["vobo"];
|
||||
$data["pago"] = $_POST["pago"];
|
||||
|
||||
$data["spf"] = $_POST["spf"];
|
||||
$data["isn"] = $_POST["isn"];
|
||||
|
||||
|
||||
if(!$vistaPrevia->VistaPreviaComprobante($data))
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$com["path"] = urlencode(WEB_ROOT."/");
|
||||
|
||||
$smarty->assign("comprobante", $com);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/export-vista-previa.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'facturaMensual':
|
||||
|
||||
$fechaX = date('Y-m-01');
|
||||
$fechaX = date('Y-m-d', strtotime($fechaX.' - 1 months'));
|
||||
$fechaI = date('Y-m-d', strtotime($fechaX.' - 2 days'));
|
||||
|
||||
$venta->setFecha($fechaI);
|
||||
$venta->setSucursalId($sucursalId);
|
||||
$comprobanteId = $venta->MesFacturado();
|
||||
|
||||
if($comprobanteId){
|
||||
$util->setError(20137,'error');
|
||||
$util->PrintErrors();
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}else{
|
||||
echo 'ok[#]';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
214
ajax/facturacion.php
Executable file
214
ajax/facturacion.php
Executable file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
$empresaId = $_SESSION['empresaId'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST['type']){
|
||||
|
||||
case 'buscar':
|
||||
|
||||
if($Usr['type'] == 'facturacion')
|
||||
$sucursalId = $_POST['idSucursal'];
|
||||
|
||||
$facturacion->setSucursalId($sucursalId);
|
||||
$facturacion->setNombre($_POST['nombre']);
|
||||
$facturacion->setRfc($_POST['rfc']);
|
||||
$facturacion->setMes($_POST['mes']);
|
||||
$facturacion->setAnio($_POST['anio']);
|
||||
$facturacion->setTiposComprobanteId($_POST['tiposComprobanteId']);
|
||||
$facturacion->setStatus($_POST['status']);
|
||||
|
||||
$comprobantes = $facturacion->Buscar();
|
||||
|
||||
$items = array();
|
||||
foreach($comprobantes['items'] as $res){
|
||||
|
||||
$cliente->setClienteId($res['userId']);
|
||||
$infC = $cliente->Info();
|
||||
$res['nombre'] = utf8_encode($infC['nombre']);
|
||||
$res['rfc'] = $infC['rfc'];
|
||||
|
||||
$res['total'] = number_format($res['total'],2);
|
||||
|
||||
$timbreFiscal = unserialize($res['timbreFiscal']);
|
||||
$res["uuid"] = $timbreFiscal["UUID"];
|
||||
|
||||
$res['fecha'] = date('d-m-Y H:i:s',strtotime($res['fecha']));
|
||||
|
||||
$venta->setComprobanteId($res['comprobanteId']);
|
||||
$resFolios = $venta->GetFoliosByCompId();
|
||||
|
||||
$folios = array();
|
||||
foreach($resFolios as $val)
|
||||
$folios[] = $val['folio'];
|
||||
|
||||
$res['tickets'] = implode(',',$folios);
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$comprobantes['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$version = $_SESSION['version'];
|
||||
|
||||
$smarty->assign('version', $version);
|
||||
$smarty->assign('comprobantes', $comprobantes);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'buscarMens':
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
if($Usr['type'] == 'facturacion')
|
||||
$sucursalId = $_POST['idSucursal'];
|
||||
|
||||
$facturacion->setSucursalId($sucursalId);
|
||||
$facturacion->setNombre($_POST['nombre']);
|
||||
$facturacion->setRfc($_POST['rfc']);
|
||||
$facturacion->setMes($_POST['mes']);
|
||||
$facturacion->setAnio($_POST['anio']);
|
||||
$facturacion->setTiposComprobanteId($_POST['tiposComprobanteId']);
|
||||
$facturacion->setStatus($_POST['status']);
|
||||
|
||||
$comprobantes = $facturacion->BuscarMens();
|
||||
|
||||
$items = array();
|
||||
foreach($comprobantes['items'] as $res){
|
||||
|
||||
$rfc->setRfcId(1);
|
||||
$infC = $rfc->Info();
|
||||
$res['nombre'] = utf8_encode($infC['razonSocial']);
|
||||
$res['rfc'] = $infC['rfc'];
|
||||
|
||||
$res['total'] = number_format($res['total'],2);
|
||||
|
||||
$timbreFiscal = unserialize($res['timbreFiscal']);
|
||||
$res["uuid"] = $timbreFiscal["UUID"];
|
||||
|
||||
$res['fecha'] = date('d-m-Y H:i:s',strtotime($res['fecha']));
|
||||
|
||||
$venta->setComprobanteId($res['comprobanteId']);
|
||||
$resFolios = $venta->GetFoliosByCompId();
|
||||
|
||||
$folios = array();
|
||||
foreach($resFolios as $val)
|
||||
$folios[] = $val['folio'];
|
||||
|
||||
$res['tickets'] = implode(',',$folios);
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$comprobantes['items'] = $items;
|
||||
|
||||
|
||||
|
||||
$version = $_SESSION['version'];
|
||||
|
||||
$smarty->assign('version', $version);
|
||||
$smarty->assign('comprobantes', $comprobantes);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/facturacion-mensual.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'showDetails':
|
||||
|
||||
$comprobanteId = $_POST['comprobanteId'];
|
||||
|
||||
$infC = $comprobante->GetInfoComprobante($comprobanteId);
|
||||
|
||||
$info['serie'] = $infC['serie'];
|
||||
$info['folio'] = $infC['folio'];
|
||||
|
||||
if($infC['facturaGlobal']){
|
||||
$rfc->setRfcId(1);
|
||||
$infR = $rfc->Info();
|
||||
$info['rfc'] = $infR['rfc'];
|
||||
}else{
|
||||
$cliente->setClienteId($infC['userId']);
|
||||
$infU = $cliente->Info();
|
||||
$info['rfc'] = $infU['rfc'];
|
||||
}
|
||||
|
||||
|
||||
$info['version'] = $_SESSION['version'];
|
||||
|
||||
$smarty->assign("info", $info);
|
||||
$smarty->assign('comprobanteId', $comprobanteId);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/acciones-factura-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'enviarPdf':
|
||||
|
||||
$comprobanteId = $_POST['comprobanteId'];
|
||||
|
||||
$facturacion->setComprobanteId($comprobanteId);
|
||||
$facturacion->SendComprobante();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'cancelarDiv':
|
||||
|
||||
$comprobanteId = $_POST['comprobanteId'];
|
||||
|
||||
$infC = $comprobante->GetInfoComprobante($comprobanteId);
|
||||
|
||||
$info['serie'] = $infC['serie'];
|
||||
$info['folio'] = $infC['folio'];
|
||||
$info['status'] = $infC['status'];
|
||||
|
||||
$cliente->setClienteId($infC['userId']);
|
||||
$infU = $cliente->Info();
|
||||
|
||||
$info['rfc'] = $infU['rfc'];
|
||||
$info['version'] = $_SESSION['version'];
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('comprobanteId', $comprobanteId);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/cancelar-factura-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'cancelarFactura':
|
||||
|
||||
$facturacion->setComprobanteId($_POST['comprobanteId']);
|
||||
$facturacion->setMotivoCancelacion($_POST['motivo']);
|
||||
|
||||
if(!$facturacion->CancelarComprobante()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
//Cambiamos a Activo el status del Ticket
|
||||
$ventaId = $facturacion->GetVentaId();
|
||||
|
||||
$venta->setVentaId($ventaId);
|
||||
$venta->setStatus('Activo');
|
||||
$venta->UpdateStatus();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}//else
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
192
ajax/facturas.php
Executable file
192
ajax/facturas.php
Executable file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$_SESSION['empresaId'] = 15;
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'doLogin':
|
||||
|
||||
$rfc = trim($_POST['rfc']);
|
||||
|
||||
if($rfc == ''){
|
||||
$util->setError(10057,'error','');
|
||||
$util->PrintErrors();
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$cliente->setRfc($rfc);
|
||||
if(!$cliente->LoginFactura())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'updateClte':
|
||||
|
||||
$clienteId = $_POST['clienteId'];
|
||||
$cliente->setRfc(trim($_POST["rfc"]));
|
||||
|
||||
if(!$clienteId){
|
||||
$clienteId = $cliente->ExistRfc();
|
||||
}else{
|
||||
|
||||
$idCliente = $cliente->ExistRfc();
|
||||
if($idCliente > 0 && $idCliente != $clienteId){
|
||||
$util->setError(10058,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$cliente->setClienteId($clienteId);
|
||||
$cliente->setRazonSocial(utf8_decode($_POST["razonSocial"]));
|
||||
$cliente->setCalle(utf8_decode($_POST["calle"]));
|
||||
$cliente->setNoExt(utf8_decode($_POST["noExt"]));
|
||||
$cliente->setNoInt(utf8_decode($_POST["noInt"]));
|
||||
$cliente->setReferencia(utf8_decode($_POST["referencia"]));
|
||||
$cliente->setColonia(utf8_decode($_POST["colonia"]));
|
||||
$cliente->setLocalidad(utf8_decode($_POST["localidad"]));
|
||||
$cliente->setMunicipio(utf8_decode($_POST["municipio"]));
|
||||
$cliente->setCodigoPostal(utf8_decode($_POST["cp"]));
|
||||
$cliente->setEstado(utf8_decode($_POST["estado"]));
|
||||
$cliente->setPais(utf8_decode($_POST["pais"]));
|
||||
$cliente->setTelefono(utf8_decode($_POST["telefono"]));
|
||||
$cliente->setEmail($_POST["email"]);
|
||||
|
||||
if($clienteId){
|
||||
|
||||
if($cliente->Update()){
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}else{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$clienteId = $cliente->Save();
|
||||
|
||||
if($clienteId){
|
||||
$_SESSION['loginKey'] = $clienteId;
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}else{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
|
||||
echo '[#]';
|
||||
echo $clienteId;
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case 'addTicket':
|
||||
|
||||
$_SESSION['idVta'] = '';
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/facturar-ticket-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddTicket':
|
||||
|
||||
$ventaId = intval(trim($_POST['ventaId']));
|
||||
|
||||
if($ventaId == 0){
|
||||
$util->setError(10059,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Checamos si existe la Nota de Venta
|
||||
$venta->setVentaId($ventaId);
|
||||
$infV = $venta->Info();
|
||||
|
||||
if($infV == ''){
|
||||
$util->setError(10060,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Checamos si esta Facturada
|
||||
|
||||
if($infV['status'] == 'Facturada'){
|
||||
$util->setError(10061,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($infV['status'] == 'Cancelado'){
|
||||
$util->setError(10062,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Checamos si esta Facturada
|
||||
$fechaV = date('Y-m-d',strtotime($infV['fecha']));
|
||||
|
||||
$fechaHoy = date('Y-m-d');
|
||||
$anioMes = date('Y-m',strtotime($fechaHoy));
|
||||
|
||||
$fechaIni = $anioMes.'-01';
|
||||
$fechaFin = $anioMes.'-31';
|
||||
|
||||
$fechaT = $fechaIni;
|
||||
$fecha2 = date('Y-m-d', strtotime($fechaT.' + 1 months'));
|
||||
$fechaUlt = date('Y-m-d', strtotime($fecha2.' - 3 days'));
|
||||
|
||||
$fechaAnt = date('Y-m-d', strtotime($fechaIni.' - 3 days'));
|
||||
|
||||
if($fechaV >= $fechaIni && $fechaV <= $fechaFin){
|
||||
$showError = false;
|
||||
}elseif($fechaV > $fechaAnt && $fechaV <= $fechaFin){
|
||||
$showError = false;
|
||||
}else{
|
||||
$showError = true;
|
||||
}
|
||||
|
||||
if($showError){
|
||||
$util->setError(10063,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$_SESSION['idVta'] = $ventaId;
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $ventaId;
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
281
ajax/inventario-ajustar.php
Executable file
281
ajax/inventario-ajustar.php
Executable file
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'ajustarInventario':
|
||||
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
$cantAjustar = trim($_POST['cantAjustar']);
|
||||
|
||||
if($sucursalId == ''){
|
||||
$util->setError(30015,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($codigoBarra == ''){
|
||||
$util->setError(20106,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo();
|
||||
|
||||
if(!$productoId){
|
||||
$util->setError(20107,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($cantAjustar == ''){
|
||||
$util->setError(20108,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
if($disponible > $cantAjustar){
|
||||
$cantidad = $disponible - $cantAjustar;
|
||||
$modo = 'Eliminar';
|
||||
}else{
|
||||
$cantidad = $cantAjustar - $disponible;
|
||||
$modo = 'Agregar';
|
||||
}
|
||||
|
||||
$db = $util->DBSelect(15);
|
||||
|
||||
if($modo == 'Eliminar'){
|
||||
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setCantidad($cantidad);
|
||||
$inventario->AjustarProductos();
|
||||
|
||||
$sql = 'INSERT INTO ajustes (sucursalId, productoId, disponible, cantidad, fecha, pedidoId, usuarioId,
|
||||
tipo)
|
||||
VALUES ("'.$sucursalId.'", "'.$productoId.'", "'.$disponible.'", "'.$cantAjustar.'",
|
||||
"'.date('Y-m-d H:i:s').'", "'.$pedidoId.'", "'.$Usr['usuarioId'].'", "'.$modo.'")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = 'SELECT proveedorId FROM producto WHERE productoId = "'.$productoId.'"';
|
||||
$db->setQuery($sql);
|
||||
$proveedorId = $db->GetSingle();
|
||||
|
||||
//Obtenemos el Sig. No de Pedido
|
||||
$sql = 'SELECT MAX(noPedido) FROM pedido';
|
||||
$db->setQuery($sql);
|
||||
$noPedido = $db->GetSingle();
|
||||
|
||||
$noPedido++;
|
||||
|
||||
//CARGAMOS LOS PRODUCTOS
|
||||
|
||||
$sql = 'INSERT INTO pedido
|
||||
(
|
||||
proveedorId,
|
||||
folioProv,
|
||||
noPedido,
|
||||
fecha,
|
||||
fechaEntrega,
|
||||
metodoCompra,
|
||||
resurtido,
|
||||
usuarioId,
|
||||
fechaAprobacion,
|
||||
userIdAprobacion,
|
||||
|
||||
fechaDistribucion,
|
||||
userIdDistribucion,
|
||||
|
||||
fechaAutorizacion,
|
||||
userIdAutorizacion,
|
||||
|
||||
fechaOrdenCompEnv,
|
||||
userIdOrdenCompEnv,
|
||||
|
||||
fechaOrdenCompIng,
|
||||
userIdOrdenCompIng,
|
||||
ajuste,
|
||||
status
|
||||
)VALUES(
|
||||
"'.$proveedorId.'",
|
||||
"FOLIO'.$noPedido.'",
|
||||
"'.$noPedido.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.date('Y-m-d').'",
|
||||
"conIva",
|
||||
"0",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"6",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"4",
|
||||
"1",
|
||||
"EnvSuc"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$pedidoId = $db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
$sql = 'INSERT INTO pedidoColor (pedidoId, productoId, colorId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 2, '.$cantidad.')';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoTalla (pedidoId, productoId, tallaId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 1, 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoDistribucion (pedidoId, productoId, sucursalId, cantidad, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$sucursalId.'", "'.$cantidad.'", "Enviado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoProducto (pedidoId, productoId, prodCatId, prodSubcatId, totalLote,
|
||||
cantLotes, cantPrendas, prendasComp, costo, precioVenta, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$infP['prodCatId'].'", "'.$infP['prodSubcatId'].'", "'.$cantidad.'",
|
||||
1, "'.$cantidad.'","1","'.$infP['costo'].'", "'.$infP['precioVentaIva'].'" ,"Aprobado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
//Envios
|
||||
|
||||
$sql = 'INSERT INTO envio (sucursalId, fecha, usuarioId, fechaRecibido, userIdRecibido, tipo, status)
|
||||
VALUES ("'.$sucursalId.'","'.date('Y-m-d H:i:s').'", 4, "'.date('Y-m-d H:i:s').'", 5, "CT", "Recibido")';
|
||||
$db->setQuery($sql);
|
||||
$envioId = $db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioPedido (envioId, pedidoId, noCajas)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioRecibir (envioId, pedidoId, productoId, noPrendas, completo)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$productoId.'", "'.$cantidad.'", "1")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
for($k=0; $k<$cantidad; $k++){
|
||||
|
||||
$sql = 'INSERT INTO inventario (envioId, pedidoId, sucursalId, productoId, prodItemId, precioVenta, cantidad, status)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$sucursalId.'", "'.$productoId.'", "'.$productoId.'", "'.$infP['precioVentaIva'].'", "1", "Disponible")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
}
|
||||
|
||||
//Guardamos los Datos
|
||||
$sql = 'INSERT INTO ajustes (sucursalId, productoId, disponible, cantidad, fecha, pedidoId, usuarioId,
|
||||
tipo)
|
||||
VALUES ("'.$sucursalId.'", "'.$productoId.'", "'.$disponible.'", "'.$cantAjustar.'",
|
||||
"'.date('Y-m-d H:i:s').'", "'.$pedidoId.'", "'.$Usr['usuarioId'].'", "'.$modo.'")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$util->setError(20109,'complete');
|
||||
$util->PrintErrors();
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
|
||||
break;
|
||||
|
||||
case 'buscarProducto':
|
||||
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
if($sucursalId == ''){
|
||||
$util->setError(30015,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($codigoBarra == ''){
|
||||
$util->setError(20106,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo();
|
||||
|
||||
if(!$productoId){
|
||||
$util->setError(20107,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$nombre = $producto->GetModeloById();
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo ' '.utf8_encode($nombre);
|
||||
|
||||
echo '[#]';
|
||||
echo ' '.$disponible;
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
433
ajax/inventario-fisico.php
Executable file
433
ajax/inventario-fisico.php
Executable file
@@ -0,0 +1,433 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'agregarReporte':
|
||||
|
||||
$inventario->setFecha(date('Y-m-d H:i:s'));
|
||||
$inventario->setUsuarioId($Usr['usuarioId']);
|
||||
$invFisicoId = $inventario->CrearInvFisico();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $invFisicoId;
|
||||
|
||||
break;
|
||||
|
||||
case 'eliminarReporte':
|
||||
|
||||
$inventario->setInvFisicoId($_POST['invFisicoId']);
|
||||
|
||||
if($inventario->DeleteInvFisico()){
|
||||
|
||||
$resReportes = $inventario->EnumRepInvFis();
|
||||
|
||||
$items = array();
|
||||
foreach($resReportes['items'] as $res){
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = urldecode($usuario->GetNameById());
|
||||
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$resReportes['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$smarty->assign('resReportes',$resReportes);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario-fisico.tpl');
|
||||
|
||||
}//if
|
||||
|
||||
break;
|
||||
|
||||
case 'updateSucursal':
|
||||
|
||||
$inventario->setSucursalId($_POST['sucursalId']);
|
||||
$inventario->setInvFisicoId($_POST['invFisicoId']);
|
||||
$inventario->UpdSucInvFisico();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo 'La sucursal fue actualizada correctamente.';
|
||||
|
||||
break;
|
||||
|
||||
case 'agregarProducto':
|
||||
|
||||
$invFisicoId = $_POST['invFisicoId'];
|
||||
$productoId = $_POST['productoId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
if($productoId == ""){
|
||||
echo 'fail[#]';
|
||||
echo 'Por favor, seleccione el producto.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$inventario->setInvFisicoId($invFisicoId);
|
||||
$inventario->setProductoId($productoId);
|
||||
if($inventario->ExistProdInvFis()){
|
||||
echo 'fail[#]';
|
||||
echo 'El producto ya fue agregado anteriormente.';
|
||||
exit;
|
||||
}
|
||||
|
||||
if($cantidad == ""){
|
||||
echo 'fail[#]';
|
||||
echo 'Por favor, ingrese la cantidad física del producto.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$inventario->setInvFisicoId($invFisicoId);
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setCantidad($cantidad);
|
||||
$inventario->SaveInvProd();
|
||||
|
||||
//Obtenemos los Productos
|
||||
$inventario->setInvFisicoId($invFisicoId);
|
||||
$resProds = $inventario->GetInvFisicoProds();
|
||||
|
||||
$productos = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$res['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$res['codigoBarra'] = $infP['codigoBarra'];
|
||||
$res['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$productos[] = $res;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo 'El producto fue agregado correctamente.';
|
||||
echo '[#]';
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario-fisico-prods.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'eliminarProducto':
|
||||
|
||||
$invFisProdId = $_POST['invFisProdId'];
|
||||
|
||||
$inventario->setInvFisProdId($invFisProdId);
|
||||
$infP = $inventario->InfoInvFisProd();
|
||||
|
||||
$inventario->DelInvFisProd();
|
||||
|
||||
//Obtenemos los Productos
|
||||
$inventario->setInvFisicoId($infP['invFisicoId']);
|
||||
$resProds = $inventario->GetInvFisicoProds();
|
||||
|
||||
$productos = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$res['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$res['codigoBarra'] = $infP['codigoBarra'];
|
||||
$res['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$productos[] = $res;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo 'El producto fue eliminado correctamente.';
|
||||
|
||||
echo '[#]';
|
||||
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario-fisico-prods.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'buscarProducto':
|
||||
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo();
|
||||
|
||||
if(!$productoId){
|
||||
echo 'fail[#]';
|
||||
echo 'No se encontró el producto con ese código. Por favor, verifique.';
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$nombre = $producto->GetModeloById();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo ' '.utf8_encode($nombre);
|
||||
echo '[#]';
|
||||
echo $productoId;
|
||||
|
||||
break;
|
||||
|
||||
case 'ajustarInventario':
|
||||
|
||||
$invFisicoId = $_POST['invFisicoId'];
|
||||
|
||||
$inventario->setInvFisicoId($invFisicoId);
|
||||
$infR = $inventario->InfoInvFisico();
|
||||
$sucursalId = $infR['sucursalId'];
|
||||
|
||||
//Metemos los Productos que estan disponibles y no fueron agregados al reporte
|
||||
|
||||
$sql = 'SELECT productoId FROM inventario
|
||||
WHERE sucursalId = '.$sucursalId.'
|
||||
AND status = "Disponible"
|
||||
GROUP BY productoId';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$productos = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
foreach($productos as $res){
|
||||
|
||||
$sql = 'SELECT invFisProdId FROM inventarioFisicoProd
|
||||
WHERE invFisicoId = '.$invFisicoId.'
|
||||
AND productoId = '.$res['productoId'];
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$existe = $util->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
if(!$existe){
|
||||
|
||||
$sql = 'INSERT INTO inventarioFisicoProd (invFisicoId, productoId, cantidad, disponible)
|
||||
VALUES('.$invFisicoId.', '.$res['productoId'].', 0, 0)';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION['empresaId'])->InsertData();
|
||||
|
||||
}//if
|
||||
}
|
||||
|
||||
//Ajustamos los Productos
|
||||
|
||||
$resProds = $inventario->GetInvFisicoProds();
|
||||
|
||||
foreach($resProds as $res){
|
||||
|
||||
$productoId = $res['productoId'];
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
$cantAjustar = $res['cantidad'];
|
||||
|
||||
if($disponible > $cantAjustar){
|
||||
$cantidad = $disponible - $cantAjustar;
|
||||
$modo = 'Eliminar';
|
||||
}else{
|
||||
$cantidad = $cantAjustar - $disponible;
|
||||
$modo = 'Agregar';
|
||||
}
|
||||
|
||||
if($modo == 'Eliminar'){
|
||||
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setCantidad($cantidad);
|
||||
$inventario->AjustarProductos();
|
||||
|
||||
}else{
|
||||
|
||||
$sql = 'SELECT proveedorId FROM producto WHERE productoId = "'.$productoId.'"';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$proveedorId = $util->DBSelect($_SESSION["empresaId"])->GetSingle();
|
||||
|
||||
//Obtenemos el Sig. No de Pedido
|
||||
$sql = 'SELECT MAX(noPedido) FROM pedido';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$noPedido = $util->DBSelect($_SESSION["empresaId"])->GetSingle();
|
||||
|
||||
$noPedido++;
|
||||
|
||||
//CARGAMOS LOS PRODUCTOS
|
||||
|
||||
$sql = 'INSERT INTO pedido
|
||||
(
|
||||
proveedorId,
|
||||
folioProv,
|
||||
noPedido,
|
||||
fecha,
|
||||
fechaEntrega,
|
||||
metodoCompra,
|
||||
resurtido,
|
||||
usuarioId,
|
||||
fechaAprobacion,
|
||||
userIdAprobacion,
|
||||
|
||||
fechaDistribucion,
|
||||
userIdDistribucion,
|
||||
|
||||
fechaAutorizacion,
|
||||
userIdAutorizacion,
|
||||
|
||||
fechaOrdenCompEnv,
|
||||
userIdOrdenCompEnv,
|
||||
|
||||
fechaOrdenCompIng,
|
||||
userIdOrdenCompIng,
|
||||
ajuste,
|
||||
status
|
||||
)VALUES(
|
||||
"'.$proveedorId.'",
|
||||
"FOLIO'.$noPedido.'",
|
||||
"'.$noPedido.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.date('Y-m-d').'",
|
||||
"conIva",
|
||||
"0",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"6",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"4",
|
||||
"1",
|
||||
"EnvSuc"
|
||||
)';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$pedidoId = $util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$infP = $util->DBSelect($_SESSION["empresaId"])->GetRow();
|
||||
|
||||
$sql = 'INSERT INTO pedidoColor (pedidoId, productoId, colorId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 2, '.$cantidad.')';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoTalla (pedidoId, productoId, tallaId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 1, 1)';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoDistribucion (pedidoId, productoId, sucursalId, cantidad, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$sucursalId.'", "'.$cantidad.'", "Enviado")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoProducto (pedidoId, productoId, prodCatId, prodSubcatId, totalLote,
|
||||
cantLotes, cantPrendas, prendasComp, costo, precioVenta, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$infP['prodCatId'].'", "'.$infP['prodSubcatId'].'", "'.$cantidad.'",
|
||||
1, "'.$cantidad.'","1","'.$infP['costo'].'", "'.$infP['precioVentaIva'].'" ,"Aprobado")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
//Envios
|
||||
|
||||
$sql = 'INSERT INTO envio (sucursalId, fecha, usuarioId, fechaRecibido, userIdRecibido, tipo, status)
|
||||
VALUES ("'.$sucursalId.'","'.date('Y-m-d H:i:s').'", 4, "'.date('Y-m-d H:i:s').'", 5, "CT", "Recibido")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$envioId = $util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioPedido (envioId, pedidoId, noCajas)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", 1)';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioRecibir (envioId, pedidoId, productoId, noPrendas, completo)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$productoId.'", "'.$cantidad.'", "1")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$infP = $util->DBSelect($_SESSION["empresaId"])->GetRow();
|
||||
|
||||
for($k=0; $k<$cantidad; $k++){
|
||||
|
||||
$sql = 'INSERT INTO inventario (envioId, pedidoId, sucursalId, productoId, prodItemId, precioVenta, cantidad, status)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$sucursalId.'", "'.$productoId.'", "'.$productoId.'", "'.$infP['precioVentaIva'].'", "1", "Disponible")';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->InsertData();
|
||||
}//for
|
||||
|
||||
}//else
|
||||
|
||||
//Actualizamos la cantidad por el disponible en caso de
|
||||
//que hayan vendido algo en ultimo momento
|
||||
$sql = 'UPDATE inventarioFisicoProd SET disponible = "'.$disponible.'"
|
||||
WHERE invFisProdId = "'.$res['invFisProdId'].'"';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
}//foreach
|
||||
|
||||
//Actualizamos el inventario
|
||||
$sql = 'UPDATE inventarioFisico SET status = "Procesado", fechaAjuste = "'.date('Y-m-d H:i:s').'"
|
||||
WHERE invFisicoId = "'.$invFisicoId.'"';
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$util->DBSelect($_SESSION["empresaId"])->UpdateData();
|
||||
|
||||
//Fin Ajustar
|
||||
|
||||
//Obtenemos los Productos
|
||||
$inventario->setInvFisicoId($invFisicoId);
|
||||
$resProds = $inventario->GetInvFisicoProds();
|
||||
|
||||
$productos = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$res['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$res['codigoBarra'] = $infP['codigoBarra'];
|
||||
$res['modelo'] = utf8_encode($infP['modelo']);
|
||||
|
||||
$productos[] = $res;
|
||||
}
|
||||
|
||||
$util->setError(20139,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$smarty->assign('productos',$productos);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario-fisico-prods.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
368
ajax/inventario-wizard.php
Executable file
368
ajax/inventario-wizard.php
Executable file
@@ -0,0 +1,368 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'uploadFile':
|
||||
|
||||
if($_POST['sucursalId'] == ''){
|
||||
|
||||
$util->setError(30015,'error');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
}elseif($_SESSION['xlsFile'] == ''){
|
||||
|
||||
if($_POST['xlsFile'] == ''){
|
||||
|
||||
$util->setError(20094,'error');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
}//elseif
|
||||
|
||||
}else{
|
||||
echo 'ok[#]';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delXlsFile':
|
||||
|
||||
$xlsFile = DOC_ROOT.'/temp/'.$_SESSION['xlsFile'];
|
||||
|
||||
@unlink($xlsFile);
|
||||
|
||||
$_SESSION['xlsFile'] = '';
|
||||
$_SESSION['identificador'] = '';
|
||||
|
||||
$util->setError(20093,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadProds':
|
||||
|
||||
$csvFile = DOC_ROOT.'/temp/'.$_SESSION['xlsFile'];
|
||||
$identificador = $_SESSION['identificador'];
|
||||
|
||||
if(!file_exists($csvFile)){
|
||||
echo 'fail[#]';
|
||||
echo 'No se encuentra el archivo '.$csvFile;
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$file = fopen($csvFile, 'r');
|
||||
|
||||
if(!$file){
|
||||
echo 'fail[#]';
|
||||
echo 'Error al abrir el archivo';
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$size = filesize($csvFile);
|
||||
|
||||
if(!$size){
|
||||
echo 'fail[#]';
|
||||
echo 'El archivo esta vacio, verifique';
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$db = $util->DBSelect(15);
|
||||
|
||||
$lines = 0;
|
||||
|
||||
while (( $field = fgetcsv($file,2048,",")) !== false ) { // Mientras hay líneas que leer...
|
||||
|
||||
if($lines >= 1){
|
||||
|
||||
$codigoBarra = trim($field[0]);
|
||||
$stock = trim($field[1]);
|
||||
|
||||
if($stock > 0){
|
||||
|
||||
$sql = 'SELECT productoId FROM producto WHERE codigoBarra = "'.$codigoBarra.'"';
|
||||
$db->setQuery($sql);
|
||||
$productoId = $db->GetSingle();
|
||||
|
||||
if($productoId){
|
||||
|
||||
$sql = 'SELECT proveedorId FROM producto WHERE codigoBarra = "'.$codigoBarra.'"';
|
||||
$db->setQuery($sql);
|
||||
$proveedorId = $db->GetSingle();
|
||||
|
||||
$sql = 'INSERT INTO
|
||||
_tablaTemp
|
||||
(
|
||||
proveedorId,
|
||||
codigoBarra,
|
||||
productoId,
|
||||
stock,
|
||||
identificador
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
|
||||
"'.$proveedorId.'",
|
||||
"'.$codigoBarra.'",
|
||||
"'.$productoId.'",
|
||||
"'.$stock.'",
|
||||
"'.$identificador.'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$found++;
|
||||
|
||||
}//if
|
||||
|
||||
$regs++;
|
||||
|
||||
}//if
|
||||
|
||||
}//if
|
||||
|
||||
$lines++;
|
||||
|
||||
}//while
|
||||
|
||||
$sucursalId = $_SESSION['wizSucId'];
|
||||
$identificador = $_SESSION['identificador'];
|
||||
|
||||
//Obtenemos el Sig. No de Pedido
|
||||
$sql = 'SELECT MAX(noPedido) FROM pedido';
|
||||
$db->setQuery($sql);
|
||||
$noPedido = $db->GetSingle();
|
||||
|
||||
$noPedido++;
|
||||
|
||||
//Guardamos Registro en la tabla InventarioWizard
|
||||
|
||||
$sql = 'INSERT INTO inventarioWizard
|
||||
(
|
||||
sucursalId,
|
||||
fecha,
|
||||
usuarioId
|
||||
)VALUES(
|
||||
"'.$sucursalId.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.$Usr['usuarioId'].'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$invWizardId = $db->InsertData();
|
||||
|
||||
//CARGAMOS LOS PRODUCTOS
|
||||
|
||||
$sql = 'SELECT * FROM _tablaTemp
|
||||
WHERE identificador = "'.$identificador.'"
|
||||
GROUP BY proveedorId';
|
||||
$db->setQuery($sql);
|
||||
$result = $db->GetResult();
|
||||
|
||||
foreach($result as $res){
|
||||
|
||||
$proveedorId = $res['proveedorId'];
|
||||
|
||||
$sql = 'INSERT INTO pedido
|
||||
(
|
||||
proveedorId,
|
||||
folioProv,
|
||||
noPedido,
|
||||
fecha,
|
||||
fechaEntrega,
|
||||
metodoCompra,
|
||||
resurtido,
|
||||
usuarioId,
|
||||
fechaAprobacion,
|
||||
userIdAprobacion,
|
||||
|
||||
fechaDistribucion,
|
||||
userIdDistribucion,
|
||||
|
||||
fechaAutorizacion,
|
||||
userIdAutorizacion,
|
||||
|
||||
fechaOrdenCompEnv,
|
||||
userIdOrdenCompEnv,
|
||||
|
||||
fechaOrdenCompIng,
|
||||
userIdOrdenCompIng,
|
||||
status,
|
||||
wizUserId
|
||||
)VALUES(
|
||||
"'.$proveedorId.'",
|
||||
"FOLIO'.$noPedido.'",
|
||||
"'.$noPedido.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.date('Y-m-d').'",
|
||||
"conIva",
|
||||
"0",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"6",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"4",
|
||||
"EnvSuc",
|
||||
"'.$Usr['usuarioId'].'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$pedidoId = $db->InsertData();
|
||||
|
||||
$sql = 'SELECT productoId FROM _tablaTemp
|
||||
WHERE proveedorId = '.$proveedorId.'
|
||||
AND identificador = "'.$identificador.'"
|
||||
GROUP BY productoId';
|
||||
$db->setQuery($sql);
|
||||
$productos = $db->GetResult();
|
||||
|
||||
//Checamos los productos
|
||||
|
||||
foreach($productos as $val){
|
||||
|
||||
$productoId = $val['productoId'];
|
||||
|
||||
$sql = 'SELECT SUM(stock) FROM _tablaTemp
|
||||
WHERE productoId = '.$productoId.'
|
||||
AND identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$cantidad = $db->GetSingle();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
$sql = 'INSERT INTO pedidoColor (pedidoId, productoId, colorId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 2, '.$cantidad.')';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoTalla (pedidoId, productoId, tallaId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 1, 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoDistribucion (pedidoId, productoId, sucursalId, cantidad, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$sucursalId.'", "'.$cantidad.'", "Enviado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoProducto (pedidoId, productoId, prodCatId, prodSubcatId, totalLote,
|
||||
cantLotes, cantPrendas, prendasComp, costo, precioVenta, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$infP['prodCatId'].'", "'.$infP['prodSubcatId'].'", "'.$cantidad.'",
|
||||
1, "'.$cantidad.'","1","'.$infP['costo'].'", "'.$infP['precioVentaIva'].'" ,"Aprobado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
//Guardamos los Productos en la Tabla
|
||||
|
||||
$sql = 'INSERT INTO inventarioWizardProd
|
||||
(
|
||||
invWizardId,
|
||||
pedidoId,
|
||||
productoId,
|
||||
cantidad
|
||||
)VALUES(
|
||||
"'.$invWizardId.'",
|
||||
"'.$pedidoId.'",
|
||||
"'.$productoId.'",
|
||||
"'.$cantidad.'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
}//foreach
|
||||
|
||||
//Actualizamos los Totales
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->UpdateTotalesByPedido();
|
||||
|
||||
//Envios
|
||||
|
||||
$sql = 'INSERT INTO envio (sucursalId, fecha, usuarioId, fechaRecibido, userIdRecibido, tipo, status)
|
||||
VALUES ("'.$sucursalId.'","'.date('Y-m-d H:i:s').'", 4, "'.date('Y-m-d H:i:s').'", 5, "CT", "Recibido")';
|
||||
$db->setQuery($sql);
|
||||
$envioId = $db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioPedido (envioId, pedidoId, noCajas)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
foreach($productos as $val){
|
||||
|
||||
$productoId = $val['productoId'];
|
||||
|
||||
$sql = 'SELECT SUM(stock) FROM _tablaTemp
|
||||
WHERE productoId = '.$productoId.'
|
||||
AND identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$cantidad = $db->GetSingle();
|
||||
|
||||
$sql = 'INSERT INTO envioRecibir (envioId, pedidoId, productoId, noPrendas, completo)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$productoId.'", "'.$cantidad.'", "1")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
for($k=0; $k<$cantidad; $k++){
|
||||
|
||||
$sql = 'INSERT INTO inventario (envioId, pedidoId, sucursalId, productoId, prodItemId, precioVenta, cantidad, status)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$sucursalId.'", "'.$productoId.'", "'.$productoId.'", "'.$infP['precioVentaIva'].'", "1", "Disponible")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$noPedido++;
|
||||
|
||||
$regs++;
|
||||
|
||||
}//foreach
|
||||
|
||||
//Eliminamos los datos de la tablatemp
|
||||
|
||||
$sql = 'DELETE FROM _tablaTemp WHERE identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$db->DeleteData();
|
||||
|
||||
//Eliminamos Todos
|
||||
|
||||
@unlink($csvFile);
|
||||
$_SESSION['xlsFile'] = '';
|
||||
$_SESSION['wizSucId'] = '';
|
||||
$_SESSION['identificador'] = '';
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
418
ajax/inventario-wizard2.php
Executable file
418
ajax/inventario-wizard2.php
Executable file
@@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'uploadFile':
|
||||
|
||||
if($_POST['sucursalId'] == ''){
|
||||
|
||||
$util->setError(30015,'error');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
if($_SESSION['xlsFile'] == ''){
|
||||
|
||||
if($_POST['xlsFile'] == ''){
|
||||
|
||||
$util->setError(20094,'error');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
|
||||
}//elseif
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
case 'delXlsFile':
|
||||
|
||||
$xlsFile = DOC_ROOT.'/temp/'.$_SESSION['xlsFile'];
|
||||
|
||||
@unlink($xlsFile);
|
||||
|
||||
$_SESSION['xlsFile'] = '';
|
||||
$_SESSION['identificador'] = '';
|
||||
|
||||
$util->setError(20093,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadProds':
|
||||
|
||||
$csvFile = DOC_ROOT.'/temp/'.$_SESSION['xlsFile'];
|
||||
$identificador = $_SESSION['identificador'];
|
||||
|
||||
if(!file_exists($csvFile)){
|
||||
echo 'fail[#]';
|
||||
echo 'No se encuentra el archivo '.$csvFile;
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$file = fopen($csvFile, 'r');
|
||||
|
||||
if(!$file){
|
||||
echo 'fail[#]';
|
||||
echo 'Error al abrir el archivo';
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$size = filesize($csvFile);
|
||||
|
||||
if(!$size){
|
||||
echo 'fail[#]';
|
||||
echo 'El archivo esta vacio, verifique';
|
||||
exit;
|
||||
}//if
|
||||
|
||||
$db = $util->DBSelect(15);
|
||||
|
||||
$sucursalId = $_SESSION['wizSucId'];
|
||||
|
||||
//Guardamos Registro en la tabla InventarioWizard
|
||||
|
||||
$sql = 'INSERT INTO inventarioWizard2
|
||||
(
|
||||
sucursalId,
|
||||
fecha,
|
||||
usuarioId
|
||||
)VALUES(
|
||||
"'.$sucursalId.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.$Usr['usuarioId'].'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$invWizardId = $db->InsertData();
|
||||
|
||||
$lines = 0;
|
||||
|
||||
while (( $field = fgetcsv($file,2048,",")) !== false ) { // Mientras hay líneas que leer...
|
||||
|
||||
if($lines >= 1){
|
||||
|
||||
$codigoBarra = trim($field[0]);
|
||||
$stock = trim($field[1]);
|
||||
|
||||
$sql = 'SELECT productoId FROM producto WHERE codigoBarra = "'.$codigoBarra.'"';
|
||||
$db->setQuery($sql);
|
||||
$productoId = $db->GetSingle();
|
||||
|
||||
$sucursalId = $_SESSION['wizSucId'];
|
||||
|
||||
//****
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
$cantAjustar = $stock;
|
||||
|
||||
if($disponible > $cantAjustar){
|
||||
$cantidad = $disponible - $cantAjustar;
|
||||
$modo = 'Eliminar';
|
||||
}else{
|
||||
$cantidad = $cantAjustar - $disponible;
|
||||
$modo = 'Agregar';
|
||||
}
|
||||
|
||||
if($modo == 'Eliminar'){
|
||||
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setCantidad($cantidad);
|
||||
$inventario->AjustarProductos();
|
||||
|
||||
$sql = 'INSERT INTO inventarioWizardProd2
|
||||
(
|
||||
invWizardId,
|
||||
pedidoId,
|
||||
productoId,
|
||||
disponible,
|
||||
cantidad
|
||||
)VALUES(
|
||||
"'.$invWizardId.'",
|
||||
"0",
|
||||
"'.$productoId.'",
|
||||
"0",
|
||||
"'.$stock.'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
}else{
|
||||
|
||||
if($productoId){
|
||||
|
||||
$sql = 'SELECT proveedorId FROM producto WHERE codigoBarra = "'.$codigoBarra.'"';
|
||||
$db->setQuery($sql);
|
||||
$proveedorId = $db->GetSingle();
|
||||
|
||||
$sql = 'INSERT INTO
|
||||
_tablaTemp
|
||||
(
|
||||
proveedorId,
|
||||
codigoBarra,
|
||||
productoId,
|
||||
stock,
|
||||
identificador
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
|
||||
"'.$proveedorId.'",
|
||||
"'.$codigoBarra.'",
|
||||
"'.$productoId.'",
|
||||
"'.$cantidad.'",
|
||||
"'.$identificador.'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$found++;
|
||||
|
||||
}//if
|
||||
|
||||
}//else
|
||||
|
||||
$regs++;
|
||||
|
||||
}//if
|
||||
|
||||
$lines++;
|
||||
|
||||
}//while
|
||||
|
||||
$sucursalId = $_SESSION['wizSucId'];
|
||||
$identificador = $_SESSION['identificador'];
|
||||
|
||||
//Obtenemos el Sig. No de Pedido
|
||||
$sql = 'SELECT MAX(noPedido) FROM pedido';
|
||||
$db->setQuery($sql);
|
||||
$noPedido = $db->GetSingle();
|
||||
|
||||
$noPedido++;
|
||||
|
||||
//CARGAMOS LOS PRODUCTOS
|
||||
|
||||
$sql = 'SELECT * FROM _tablaTemp
|
||||
WHERE identificador = "'.$identificador.'"
|
||||
GROUP BY proveedorId';
|
||||
$db->setQuery($sql);
|
||||
$result = $db->GetResult();
|
||||
|
||||
foreach($result as $res){
|
||||
|
||||
$proveedorId = $res['proveedorId'];
|
||||
|
||||
$sql = 'INSERT INTO pedido
|
||||
(
|
||||
proveedorId,
|
||||
folioProv,
|
||||
noPedido,
|
||||
fecha,
|
||||
fechaEntrega,
|
||||
metodoCompra,
|
||||
resurtido,
|
||||
usuarioId,
|
||||
fechaAprobacion,
|
||||
userIdAprobacion,
|
||||
|
||||
fechaDistribucion,
|
||||
userIdDistribucion,
|
||||
|
||||
fechaAutorizacion,
|
||||
userIdAutorizacion,
|
||||
|
||||
fechaOrdenCompEnv,
|
||||
userIdOrdenCompEnv,
|
||||
|
||||
fechaOrdenCompIng,
|
||||
userIdOrdenCompIng,
|
||||
status,
|
||||
wizUserId
|
||||
)VALUES(
|
||||
"'.$proveedorId.'",
|
||||
"FOLIO'.$noPedido.'",
|
||||
"'.$noPedido.'",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"'.date('Y-m-d').'",
|
||||
"conIva",
|
||||
"0",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"6",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"3",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"2",
|
||||
"'.date('Y-m-d H:i:s').'",
|
||||
"4",
|
||||
"EnvSuc",
|
||||
"'.$Usr['usuarioId'].'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$pedidoId = $db->InsertData();
|
||||
|
||||
$sql = 'SELECT productoId FROM _tablaTemp
|
||||
WHERE proveedorId = '.$proveedorId.'
|
||||
AND identificador = "'.$identificador.'"
|
||||
GROUP BY productoId';
|
||||
$db->setQuery($sql);
|
||||
$productos = $db->GetResult();
|
||||
|
||||
//Checamos los productos
|
||||
|
||||
foreach($productos as $val){
|
||||
|
||||
$productoId = $val['productoId'];
|
||||
|
||||
$sql = 'SELECT SUM(stock) FROM _tablaTemp
|
||||
WHERE productoId = '.$productoId.'
|
||||
AND identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$cantidad = $db->GetSingle();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
$sql = 'INSERT INTO pedidoColor (pedidoId, productoId, colorId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 2, '.$cantidad.')';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoTalla (pedidoId, productoId, tallaId, cantidad)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", 1, 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoDistribucion (pedidoId, productoId, sucursalId, cantidad, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$sucursalId.'", "'.$cantidad.'", "Enviado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO pedidoProducto (pedidoId, productoId, prodCatId, prodSubcatId, totalLote,
|
||||
cantLotes, cantPrendas, prendasComp, costo, precioVenta, status)
|
||||
VALUES ("'.$pedidoId.'","'.$productoId.'", "'.$infP['prodCatId'].'", "'.$infP['prodSubcatId'].'", "'.$cantidad.'",
|
||||
1, "'.$cantidad.'","1","'.$infP['costo'].'", "'.$infP['precioVentaIva'].'" ,"Aprobado")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
//Guardamos los Productos en la Tabla
|
||||
|
||||
$sql = 'INSERT INTO inventarioWizardProd2
|
||||
(
|
||||
invWizardId,
|
||||
pedidoId,
|
||||
productoId,
|
||||
disponible,
|
||||
cantidad
|
||||
)VALUES(
|
||||
"'.$invWizardId.'",
|
||||
"'.$pedidoId.'",
|
||||
"'.$productoId.'",
|
||||
"0",
|
||||
"'.$stock.'"
|
||||
)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
}//foreach
|
||||
|
||||
//Actualizamos los Totales
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->UpdateTotalesByPedido();
|
||||
|
||||
//Envios
|
||||
|
||||
$sql = 'INSERT INTO envio (sucursalId, fecha, usuarioId, fechaRecibido, userIdRecibido, tipo, status)
|
||||
VALUES ("'.$sucursalId.'","'.date('Y-m-d H:i:s').'", 4, "'.date('Y-m-d H:i:s').'", 5, "CT", "Recibido")';
|
||||
$db->setQuery($sql);
|
||||
$envioId = $db->InsertData();
|
||||
|
||||
$sql = 'INSERT INTO envioPedido (envioId, pedidoId, noCajas)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", 1)';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
foreach($productos as $val){
|
||||
|
||||
$productoId = $val['productoId'];
|
||||
|
||||
$sql = 'SELECT SUM(stock) FROM _tablaTemp
|
||||
WHERE productoId = '.$productoId.'
|
||||
AND identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$cantidad = $db->GetSingle();
|
||||
|
||||
$sql = 'INSERT INTO envioRecibir (envioId, pedidoId, productoId, noPrendas, completo)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$productoId.'", "'.$cantidad.'", "1")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
|
||||
$sql = 'SELECT * FROM producto
|
||||
WHERE productoId = '.$productoId;
|
||||
$db->setQuery($sql);
|
||||
$infP = $db->GetRow();
|
||||
|
||||
for($k=0; $k<$cantidad; $k++){
|
||||
|
||||
$sql = 'INSERT INTO inventario (envioId, pedidoId, sucursalId, productoId, prodItemId, precioVenta, cantidad, status)
|
||||
VALUES ("'.$envioId.'", "'.$pedidoId.'", "'.$sucursalId.'", "'.$productoId.'", "'.$productoId.'", "'.$infP['precioVentaIva'].'", "1", "Disponible")';
|
||||
$db->setQuery($sql);
|
||||
$db->InsertData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$noPedido++;
|
||||
|
||||
$regs++;
|
||||
|
||||
}//foreach
|
||||
|
||||
//Eliminamos los datos de la tablatemp
|
||||
|
||||
$sql = 'DELETE FROM _tablaTemp WHERE identificador = "'.$identificador.'"';
|
||||
$db->setQuery($sql);
|
||||
$db->DeleteData();
|
||||
|
||||
//Eliminamos Todos
|
||||
|
||||
@unlink($csvFile);
|
||||
$_SESSION['xlsFile'] = '';
|
||||
$_SESSION['wizSucId'] = '';
|
||||
$_SESSION['identificador'] = '';
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
280
ajax/inventario.php
Executable file
280
ajax/inventario.php
Executable file
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'search':
|
||||
|
||||
$disponible = $_POST['disponible2'];
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
$inventario->setProveedorId($_POST['proveedorId2']);
|
||||
$inventario->setProdCatId($_POST['prodCatId2']);
|
||||
$inventario->setProdSubcatId($_POST['prodSubcatId2']);
|
||||
$inventario->setModelo($_POST['modelo2']);
|
||||
|
||||
if($Usr['type'] == 'almacen' || $Usr['type'] == 'centralizador')
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
|
||||
$resProds = $inventario->Search();
|
||||
|
||||
$items = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resTallas = $producto->GetTallas();
|
||||
|
||||
$tallas = array();
|
||||
foreach($resTallas as $val){
|
||||
$atribVal->setAtribValId($val['tallaId']);
|
||||
$tallas[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['talla'] = implode(', ',$tallas);
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resColores = $producto->GetColores();
|
||||
|
||||
$colores = array();
|
||||
foreach($resColores as $val){
|
||||
$atribVal->setAtribValId($val['colorId']);
|
||||
$colores[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['color'] = implode(', ',$colores);
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resAtributos = $producto->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $val){
|
||||
$atribVal->setAtribValId($val['atribValId']);
|
||||
$atributos[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['atributos'] = implode(', ',$atributos);
|
||||
|
||||
//Obtenemos los Codigos de Barra
|
||||
$inventario->setProductoId($res['productoId']);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$res['cantidad'] = $inventario->GetTotalItemsBySuc();
|
||||
|
||||
if($disponible == 1 && $res['cantidad'] > 0)
|
||||
$items[] = $util->EncodeRow($res);
|
||||
elseif($disponible == 0)
|
||||
$items[] = $util->EncodeRow($res);
|
||||
|
||||
}//foreach
|
||||
|
||||
/*
|
||||
if($Usr['type'] == 'almacen'){
|
||||
$items2 = $items;
|
||||
$items = array();
|
||||
|
||||
foreach($items2 as $key => $resItem){
|
||||
if($resItem['cantidad'] != 0)
|
||||
$items[$key] = $items2[$key];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'searchBloq':
|
||||
|
||||
$sucursalId = $_SESSION['idSuc'];
|
||||
$inventario->setProveedorId($_POST['proveedorId2']);
|
||||
$inventario->setProdCatId($_POST['prodCatId2']);
|
||||
$inventario->setProdSubcatId($_POST['prodSubcatId2']);
|
||||
$inventario->setModelo($_POST['modelo2']);
|
||||
$inventario->setDescripcion($_POST['descripcion2']);
|
||||
|
||||
$resProds = $inventario->Search();
|
||||
|
||||
$items = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$sql = "SELECT
|
||||
SUM(cantidad)
|
||||
FROM
|
||||
inventario
|
||||
WHERE
|
||||
sucursalId = '".$sucursalId."'
|
||||
AND
|
||||
prodItemId = '".$res['productoId']."'
|
||||
AND
|
||||
status = 'Bloqueado'";
|
||||
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$res['cantidad'] = $util->DBSelect($_SESSION["empresaId"])->GetSingle();
|
||||
|
||||
if($res['cantidad'] == 0)
|
||||
continue;
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resTallas = $producto->GetTallas();
|
||||
|
||||
$tallas = array();
|
||||
foreach($resTallas as $val){
|
||||
$atribVal->setAtribValId($val['tallaId']);
|
||||
$tallas[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['talla'] = implode(', ',$tallas);
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resColores = $producto->GetColores();
|
||||
|
||||
$colores = array();
|
||||
foreach($resColores as $val){
|
||||
$atribVal->setAtribValId($val['colorId']);
|
||||
$colores[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['color'] = implode(', ',$colores);
|
||||
|
||||
$producto->setProductoId($res['productoId']);
|
||||
$resAtributos = $producto->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $val){
|
||||
$atribVal->setAtribValId($val['atribValId']);
|
||||
$atributos[] = $atribVal->GetNameById();
|
||||
}
|
||||
|
||||
$res['atributos'] = implode(', ',$atributos);
|
||||
|
||||
//Obtenemos los Codigos de Barra
|
||||
/*
|
||||
$inventario->setProductoId($res['productoId']);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$res['cantidad'] = $inventario->GetTotalItemsBloqBySuc();
|
||||
*/
|
||||
if($res['cantidad'])
|
||||
$items[] = $util->EncodeRow($res);
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('tipo', 'Bloqueados');
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/inventario.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadSubcats':
|
||||
|
||||
$prodSubcat->setProdCatId($_POST['prodCatId']);
|
||||
$subcategorias = $prodSubcat->EnumerateAll();
|
||||
$subcategorias = $util->EncodeResult($subcategorias);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('subcategorias', $subcategorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumProdSubcatSearch.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'fillInfoProd':
|
||||
|
||||
$producto->setProdItemId($_POST['prodItemId']);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$producto->setProductoId($info['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $info['prodItemId'];
|
||||
echo '[#]';
|
||||
echo $infP['precioVenta'];
|
||||
echo '[#]';
|
||||
echo $infP['modelo'].' '.$infP['descripcion'];
|
||||
|
||||
break;
|
||||
|
||||
case 'sendReportParcial':
|
||||
|
||||
$repInvParcialId = $_POST['repInvParcialId'];
|
||||
$cantidades = $_POST['cant'];
|
||||
|
||||
foreach($cantidades as $productoId => $valor){
|
||||
|
||||
if($valor == ''){
|
||||
$util->setError(10050,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
foreach($cantidades as $productoId => $valor){
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$cantReal = $inventario->GetTotalItemsBySuc();
|
||||
|
||||
$inventario->setRepInvParcialId($repInvParcialId);
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setCantidad($valor);
|
||||
$inventario->setCantReal($cantReal);
|
||||
$inventario->SaveRepProd();
|
||||
|
||||
}//foreach
|
||||
|
||||
//Actualizamos el status
|
||||
$inventario->setRepInvParcialId($repInvParcialId);
|
||||
$inventario->UpdateStatusRepParcial('Generado');
|
||||
|
||||
echo 'ok[#]';
|
||||
echo '<div align="center">
|
||||
<img src="'.WEB_ROOT.'/images/icons/ok2.png">
|
||||
<h2>El reporte fue enviado correctamente.</h2>
|
||||
</div>
|
||||
<br>
|
||||
<div align="center"><a href="'.WEB_ROOT.'/inventario"> << Regresar</a></div>';
|
||||
|
||||
break;
|
||||
|
||||
case 'liberarProductos':
|
||||
|
||||
$venta->setSucursalId($sucursalId);
|
||||
$venta->LiberarProductos();
|
||||
|
||||
$util->setError(10052,'complete');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
21
ajax/login.php
Executable file
21
ajax/login.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$empresa->setEmail($_POST['email']);
|
||||
$empresa->setPassword($_POST['password']);
|
||||
$empresa->setEmpresaId(15);
|
||||
|
||||
if(!$empresa->DoLogin())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
}
|
||||
|
||||
?>
|
||||
21
ajax/login.php~
Executable file
21
ajax/login.php~
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
print_r($_POST);
|
||||
$empresa->setEmail($_POST['email']);
|
||||
$empresa->setPassword($_POST['password']);
|
||||
$empresa->setEmpresaId(15);
|
||||
|
||||
if(!$empresa->DoLogin())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
}
|
||||
|
||||
?>
|
||||
19
ajax/logout.php
Executable file
19
ajax/logout.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
unset($_SESSION["loginKey"]);
|
||||
session_destroy();
|
||||
|
||||
$tipoUsr = $_SESSION['tipoUsr'];
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
if($tipoUsr == 'Cliente')
|
||||
echo 'facturas';
|
||||
else
|
||||
echo 'login';
|
||||
|
||||
?>
|
||||
95
ajax/materiales.php
Executable file
95
ajax/materiales.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'addMaterial':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-material-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddMaterial':
|
||||
|
||||
$material->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$material->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$materiales = $material->Enumerate();
|
||||
$materiales['items'] = $util->EncodeResult($materiales['items']);
|
||||
|
||||
$smarty->assign('materiales', $materiales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/materiales.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editMaterial':
|
||||
|
||||
$material->setMaterialId($_POST['id']);
|
||||
$info = $material->Info();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-material-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditMaterial':
|
||||
|
||||
$material->setMaterialId($_POST['materialId']);
|
||||
$material->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$material->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$materiales = $material->Enumerate();
|
||||
$materiales['items'] = $util->EncodeResult($materiales['items']);
|
||||
|
||||
$smarty->assign('materiales', $materiales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/materiales.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deleteMaterial':
|
||||
|
||||
$material->setMaterialId($_POST['id']);
|
||||
|
||||
if($material->Baja())
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$materiales = $material->Enumerate();
|
||||
$materiales['items'] = $util->EncodeResult($materiales['items']);
|
||||
|
||||
$smarty->assign('materiales', $materiales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/materiales.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
95
ajax/metodos-pago.php
Executable file
95
ajax/metodos-pago.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "addMetodoPago":
|
||||
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-metodo-pago-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveAddMetodoPago":
|
||||
|
||||
$metodoPago->setNombre($_POST["nombre"]);
|
||||
|
||||
if(!$metodoPago->Save())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo "[#]";
|
||||
$metodosPago = $metodoPago->Enumerate();
|
||||
$metodosPago['items'] = $util->EncodeResult($metodosPago['items']);
|
||||
|
||||
$smarty->assign("metodosPago", $metodosPago);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/metodos-pago.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editMetodoPago":
|
||||
|
||||
$metodoPago->setMetodoPagoId($_POST['id']);
|
||||
$info = $metodoPago->Info();
|
||||
|
||||
$smarty->assign("info", $info);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-metodo-pago-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveEditMetodoPago":
|
||||
|
||||
$metodoPago->setMetodoPagoId($_POST['metodoPagoId']);
|
||||
$metodoPago->setNombre($_POST["nombre"]);
|
||||
|
||||
if(!$metodoPago->Update())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo "[#]";
|
||||
$metodosPago = $metodoPago->Enumerate();
|
||||
$metodosPago['items'] = $util->EncodeResult($metodosPago['items']);
|
||||
|
||||
$smarty->assign("metodosPago", $metodosPago);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/metodos-pago.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case "deleteMetodoPago":
|
||||
|
||||
$metodoPago->setMetodoPagoId($_POST['id']);
|
||||
|
||||
if($metodoPago->Baja())
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$metodosPago = $metodoPago->Enumerate();
|
||||
$metodosPago['items'] = $util->EncodeResult($metodosPago['items']);
|
||||
|
||||
$smarty->assign("metodosPago", $metodosPago);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/metodos-pago.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
193
ajax/monederos.php
Executable file
193
ajax/monederos.php
Executable file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addMonedero':
|
||||
|
||||
$nextId = $monedero->GetNextId();
|
||||
$codigo = strtoupper($monedero->GeneraCodigo());
|
||||
|
||||
$info['codigo'] = $nextId.$codigo;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-monedero-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveMonedero':
|
||||
|
||||
$fecha = date('Y-m-d H:i:s');
|
||||
$saldo = $_POST['saldo'];
|
||||
|
||||
$monedero->setTipo($_POST['tipo']);
|
||||
$monedero->setCodigo($_POST['codigo']);
|
||||
$monedero->setSaldo($saldo);
|
||||
$monedero->setFecha($fecha);
|
||||
$monedero->setStatus($_POST['status']);
|
||||
|
||||
$monederoId = $monedero->Save();
|
||||
|
||||
if(!$monederoId)
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
|
||||
//Agregamos el registro en el Historial del Monedero
|
||||
|
||||
$monedero->setFecha($fecha);
|
||||
$monedero->setMonederoId($monederoId);
|
||||
$monedero->setTotal($saldo);
|
||||
$monedero->setTipo('Inicial');
|
||||
$monedero->SaveHistorial();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$monederos = $monedero->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($monederos['items'] as $res){
|
||||
|
||||
$monedero->setMonederoId($res['monederoId']);
|
||||
$res['historial'] = $monedero->EnumHistorial();
|
||||
|
||||
$items[] = $res;
|
||||
|
||||
}
|
||||
$monederos['items'] = $items;
|
||||
|
||||
$smarty->assign('monederos', $monederos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/monederos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editMonedero':
|
||||
|
||||
$monederoId = $_POST['monederoId'];
|
||||
|
||||
$monedero->setMonederoId($monederoId);
|
||||
$info = $monedero->Info();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-monedero-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditMonedero':
|
||||
|
||||
$monedero->setMonederoId($_POST['monederoId']);
|
||||
$monedero->setStatus($_POST['status']);
|
||||
|
||||
if(!$monedero->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$monederos = $monedero->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($monederos['items'] as $res){
|
||||
|
||||
$monedero->setMonederoId($res['monederoId']);
|
||||
$res['historial'] = $monedero->EnumHistorial();
|
||||
|
||||
$items[] = $res;
|
||||
|
||||
}
|
||||
$monederos['items'] = $items;
|
||||
|
||||
$smarty->assign('monederos', $monederos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/monederos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteMonedero':
|
||||
|
||||
$monederoId = $_POST['monederoId'];
|
||||
|
||||
$monedero->setMonederoId($monederoId);
|
||||
|
||||
if(!$monedero->Delete())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$monederos = $monedero->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($monederos['items'] as $res){
|
||||
|
||||
$monedero->setMonederoId($res['monederoId']);
|
||||
$res['historial'] = $monedero->EnumHistorial();
|
||||
|
||||
$items[] = $res;
|
||||
|
||||
}
|
||||
$monederos['items'] = $items;
|
||||
|
||||
$smarty->assign('monederos', $monederos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/monederos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
|
||||
$monedero->setTipo($_POST['tipo']);
|
||||
$monedero->setStatus($_POST['status']);
|
||||
$result = $monedero->Search();
|
||||
|
||||
$items = array();
|
||||
foreach($result as $res){
|
||||
|
||||
$monedero->setMonederoId($res['monederoId']);
|
||||
$res['historial'] = $monedero->EnumHistorial();
|
||||
|
||||
$items[] = $res;
|
||||
|
||||
}
|
||||
$monederos['items'] = $items;
|
||||
|
||||
$smarty->assign('monederos', $monederos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/monederos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadStatus':
|
||||
|
||||
$info['tipo'] = $_POST['tipo'];
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumStatusMon.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
108
ajax/motivos.php
Executable file
108
ajax/motivos.php
Executable file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addMotivo':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-motivo-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveMotivo':
|
||||
|
||||
$motivo->setNombre($_POST['name']);
|
||||
|
||||
if(!$motivo->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$motivos = $motivo->Enumerate();
|
||||
$motivos["items"] = $util->EncodeResult($motivos["items"]);
|
||||
|
||||
$smarty->assign('motivos', $motivos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/motivos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editMotivo':
|
||||
|
||||
$motivoId = $_POST['motivoId'];
|
||||
|
||||
$motivo->setMotivoId($motivoId);
|
||||
$info = $motivo->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-motivo-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditMotivo':
|
||||
|
||||
$motivo->setMotivoId($_POST['motivoId']);
|
||||
$motivo->setNombre($_POST['name']);
|
||||
|
||||
if(!$motivo->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$motivos = $motivo->Enumerate();
|
||||
$motivos["items"] = $util->EncodeResult($motivos["items"]);
|
||||
|
||||
$smarty->assign('motivos', $motivos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/motivos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteMotivo':
|
||||
|
||||
$motivoId = $_POST['motivoId'];
|
||||
|
||||
$motivo->setMotivoId($motivoId);
|
||||
|
||||
if(!$motivo->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$motivos = $motivo->Enumerate();
|
||||
$motivos["items"] = $util->EncodeResult($motivos["items"]);
|
||||
|
||||
$smarty->assign('motivos', $motivos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/motivos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
279
ajax/pedidos-agregar.php
Executable file
279
ajax/pedidos-agregar.php
Executable file
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addTalla':
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$proporcionNT = $_POST['proporcionNT'];
|
||||
$proporcionIT = $_POST['proporcionIT'];
|
||||
$proporcionT = $_POST['proporcionT'];
|
||||
$proporcionNC = $_POST['proporcionNC'];
|
||||
$proporcionIC = $_POST['proporcionIC'];
|
||||
$proporcionC = $_POST['proporcionC'];
|
||||
|
||||
$tallas = array();
|
||||
foreach($proporcionNT as $k => $nombre){
|
||||
$res['id'] = $proporcionIT[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionT[$k];
|
||||
$tallas[] = $res;
|
||||
}
|
||||
|
||||
$res['id'] = '';
|
||||
$res['nombre'] = '';
|
||||
$res['cantidad'] = 0;
|
||||
$tallas[] = $res;
|
||||
|
||||
$_SESSION['tallas'] = $tallas;
|
||||
|
||||
$colores = array();
|
||||
foreach($proporcionNC as $k => $nombre){
|
||||
$res['id'] = $proporcionIC[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionC[$k];
|
||||
$colores[] = $res;
|
||||
}
|
||||
|
||||
$_SESSION['colores'] = $colores;
|
||||
|
||||
//Obtenemos Totales
|
||||
|
||||
foreach($tallas as $idT => $t){
|
||||
|
||||
foreach($colores as $idC => $c)
|
||||
$subtotales[$idT][$idC] = 0;
|
||||
|
||||
$totales[$idT] = 0;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totalLote = 0;
|
||||
|
||||
if($productoId){
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('totalLote', $totalLote);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('subtotales', $subtotales);
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-proporciones.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'delTalla':
|
||||
|
||||
$key = $_POST['key'];
|
||||
$productoId = $_POST['productoId'];
|
||||
$proporcionNT = $_POST['proporcionNT'];
|
||||
$proporcionIT = $_POST['proporcionIT'];
|
||||
$proporcionT = $_POST['proporcionT'];
|
||||
$proporcionNC = $_POST['proporcionNC'];
|
||||
$proporcionIC = $_POST['proporcionIC'];
|
||||
$proporcionC = $_POST['proporcionC'];
|
||||
|
||||
$tallas = array();
|
||||
foreach($proporcionNT as $k => $nombre){
|
||||
$res['id'] = $proporcionIT[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionT[$k];
|
||||
$tallas[] = $res;
|
||||
}
|
||||
|
||||
unset($tallas[$key]);
|
||||
|
||||
$_SESSION['tallas'] = $tallas;
|
||||
|
||||
$colores = array();
|
||||
foreach($proporcionNC as $k => $nombre){
|
||||
$res['id'] = $proporcionIC[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionC[$k];
|
||||
$colores[] = $res;
|
||||
}
|
||||
|
||||
$_SESSION['colores'] = $colores;
|
||||
|
||||
//Obtenemos Totales
|
||||
|
||||
foreach($tallas as $idT => $t){
|
||||
|
||||
foreach($colores as $idC => $c)
|
||||
$subtotales[$idT][$idC] = 0;
|
||||
|
||||
$totales[$idT] = 0;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totalLote = 0;
|
||||
|
||||
if($productoId){
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('totalLote', $totalLote);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('subtotales', $subtotales);
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-proporciones.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'addColor':
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$proporcionNT = $_POST['proporcionNT'];
|
||||
$proporcionIT = $_POST['proporcionIT'];
|
||||
$proporcionT = $_POST['proporcionT'];
|
||||
$proporcionNC = $_POST['proporcionNC'];
|
||||
$proporcionIC = $_POST['proporcionIC'];
|
||||
$proporcionC = $_POST['proporcionC'];
|
||||
|
||||
$tallas = array();
|
||||
foreach($proporcionNT as $k => $nombre){
|
||||
$res['id'] = $proporcionIT[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionT[$k];
|
||||
$tallas[] = $res;
|
||||
}
|
||||
|
||||
$_SESSION['tallas'] = $tallas;
|
||||
|
||||
$colores = array();
|
||||
foreach($proporcionNC as $k => $nombre){
|
||||
$res['id'] = $proporcionIC[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionC[$k];
|
||||
$colores[] = $res;
|
||||
}
|
||||
|
||||
$res['id'] = '';
|
||||
$res['nombre'] = '';
|
||||
$res['cantidad'] = 0;
|
||||
$colores[] = $res;
|
||||
|
||||
$_SESSION['colores'] = $colores;
|
||||
|
||||
//Obtenemos Totales
|
||||
|
||||
foreach($tallas as $idT => $t){
|
||||
|
||||
foreach($colores as $idC => $c)
|
||||
$subtotales[$idT][$idC] = 0;
|
||||
|
||||
$totales[$idT] = 0;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totalLote = 0;
|
||||
|
||||
if($productoId){
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('totalLote', $totalLote);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('subtotales', $subtotales);
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-proporciones.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'delColor':
|
||||
|
||||
$key = $_POST['key'];
|
||||
$productoId = $_POST['productoId'];
|
||||
$proporcionNT = $_POST['proporcionNT'];
|
||||
$proporcionIT = $_POST['proporcionIT'];
|
||||
$proporcionT = $_POST['proporcionT'];
|
||||
$proporcionNC = $_POST['proporcionNC'];
|
||||
$proporcionIC = $_POST['proporcionIC'];
|
||||
$proporcionC = $_POST['proporcionC'];
|
||||
|
||||
$tallas = array();
|
||||
foreach($proporcionNT as $k => $nombre){
|
||||
$res['id'] = $proporcionIT[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionT[$k];
|
||||
$tallas[] = $res;
|
||||
}
|
||||
|
||||
$_SESSION['tallas'] = $tallas;
|
||||
|
||||
$colores = array();
|
||||
foreach($proporcionNC as $k => $nombre){
|
||||
$res['id'] = $proporcionIC[$k];
|
||||
$res['nombre'] = strtoupper($nombre);
|
||||
$res['cantidad'] = $proporcionC[$k];
|
||||
$colores[] = $res;
|
||||
}
|
||||
|
||||
unset($colores[$key]);
|
||||
|
||||
$_SESSION['colores'] = $colores;
|
||||
|
||||
//Obtenemos Totales
|
||||
|
||||
foreach($tallas as $idT => $t){
|
||||
|
||||
foreach($colores as $idC => $c)
|
||||
$subtotales[$idT][$idC] = 0;
|
||||
|
||||
$totales[$idT] = 0;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totalLote = 0;
|
||||
|
||||
if($productoId){
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('colores', $colores);
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('totalLote', $totalLote);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('subtotales', $subtotales);
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/pedidos-proporciones.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
94
ajax/pedidos-distribucion.php
Executable file
94
ajax/pedidos-distribucion.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'actualizarDist':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$sucursales = $sucursal->GetSucursalesByEmpresaId();
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$resProducts = $pedido->GetProductos();
|
||||
|
||||
$dist = array();
|
||||
foreach($resProducts as $res){
|
||||
|
||||
$productoId = $res['productoId'];
|
||||
$cantPrendas = $res['cantPrendas'];
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$nomProducto = utf8_encode($producto->GetModeloById());
|
||||
|
||||
$totPrendas = 0;
|
||||
foreach($sucursales as $suc){
|
||||
|
||||
$sucursalId = $suc['sucursalId'];
|
||||
$prendasSuc = $_POST['cant_'.$productoId.'_'.$sucursalId];
|
||||
|
||||
$card['productoId'] = $productoId;
|
||||
$card['sucursalId'] = $sucursalId;
|
||||
$card['cantidad'] = $prendasSuc;
|
||||
|
||||
$dist[] = $card;
|
||||
|
||||
$totPrendas += $prendasSuc;
|
||||
|
||||
}//foreach
|
||||
|
||||
$continue = true;
|
||||
if($totPrendas > $cantPrendas){
|
||||
$util->setError(20096,'error','',strtoupper($nomProducto));
|
||||
$continue = false;
|
||||
}elseif($totPrendas < $cantPrendas){
|
||||
$util->setError(20097,'error','',strtoupper($nomProducto));
|
||||
$continue = false;
|
||||
}
|
||||
|
||||
if(!$continue){
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
//Guardamos las Distribuciones
|
||||
|
||||
foreach($dist as $res){
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->setProductoId($res['productoId']);
|
||||
$pedido->setSucursalId($res['sucursalId']);
|
||||
$pedido->setCantidad($res['cantidad']);
|
||||
|
||||
$infP = $pedido->InfoProdDist();
|
||||
|
||||
if($infP)
|
||||
$pedido->UpdateDistribucion();
|
||||
else
|
||||
$pedido->SaveDistribucion();
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
$_SESSION['msgPed'] = 'UpdDistribucion';
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
3695
ajax/pedidos.php
Executable file
3695
ajax/pedidos.php
Executable file
File diff suppressed because it is too large
Load Diff
65
ajax/politicas.php
Executable file
65
ajax/politicas.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addPolitica':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-politica-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'savePolitica':
|
||||
|
||||
$politica->setTipo($_POST['accion']);
|
||||
$politica->setPorcentajeEvaluacion($_POST['porcentaje_evaluacion']);
|
||||
$politica->setPorcentajeBonificacion($_POST['porcentaje_bonificacion']);
|
||||
|
||||
if(!$politica->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$politicas = $politica->Enumerate();
|
||||
|
||||
$smarty->assign('politicas', $politicas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/politicas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deletePolitica':
|
||||
|
||||
$politica->setPoliticaId($_POST['politicaId']);
|
||||
|
||||
if(!$politica->Baja())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$politicas = $politica->Enumerate();
|
||||
|
||||
$smarty->assign('politicas', $politicas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/politicas.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
201
ajax/productos-categorias.php
Executable file
201
ajax/productos-categorias.php
Executable file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addCategory':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-producto-categoria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveCategory':
|
||||
|
||||
$prodCat->setNombre($_POST['name']);
|
||||
|
||||
if(!$prodCat->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$categorias = $prodCat->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($categorias['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$card['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdCatId($res['prodCatId']);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $val){
|
||||
|
||||
$val['nombre'] = utf8_encode($val['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($val['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $atr){
|
||||
$atributo->setAtributoId($atr['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
$val['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $val;
|
||||
}
|
||||
$card['subcategorias'] = $subcategorias;
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$categorias['items'] = $items;
|
||||
|
||||
$smarty->assign('categorias', $categorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-categorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editCategory':
|
||||
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
|
||||
$prodCat->setProdCatId($prodCatId);
|
||||
$info = $prodCat->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-producto-categoria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditCategory':
|
||||
|
||||
$prodCat->setProdCatId($_POST['prodCatId']);
|
||||
$prodCat->setNombre($_POST['name']);
|
||||
|
||||
if(!$prodCat->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$categorias = $prodCat->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($categorias['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$card['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdCatId($res['prodCatId']);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $val){
|
||||
|
||||
$val['nombre'] = utf8_encode($val['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($val['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $atr){
|
||||
$atributo->setAtributoId($atr['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
$val['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $val;
|
||||
}
|
||||
$card['subcategorias'] = $subcategorias;
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$categorias['items'] = $items;
|
||||
|
||||
$smarty->assign('categorias', $categorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-categorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteCategory':
|
||||
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
|
||||
$prodCat->setProdCatId($prodCatId);
|
||||
|
||||
if(!$prodCat->Delete())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
|
||||
$categorias = $prodCat->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($categorias['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$card['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdCatId($res['prodCatId']);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $val){
|
||||
|
||||
$val['nombre'] = utf8_encode($val['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($val['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $atr){
|
||||
$atributo->setAtributoId($atr['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
$val['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $val;
|
||||
}
|
||||
$card['subcategorias'] = $subcategorias;
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$categorias['items'] = $items;
|
||||
|
||||
$smarty->assign('categorias', $categorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-categorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
79
ajax/productos-materiales.php
Executable file
79
ajax/productos-materiales.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addMaterial':
|
||||
|
||||
$prodMats = array();
|
||||
|
||||
if(count($_POST['materialId']) == 0)
|
||||
$_POST['materialId'] = array();
|
||||
|
||||
foreach($_POST['materialId'] as $k => $materialId){
|
||||
$card['materialId'] = $materialId;
|
||||
$card['porcentaje'] = $_POST['porcentaje'][$k];
|
||||
|
||||
$prodMats[$k] = $card;
|
||||
}
|
||||
|
||||
$card['materialId'] = 0;
|
||||
$card['porcentaje'] = 0;
|
||||
|
||||
$prodMats[] = $card;
|
||||
|
||||
$_SESSION['prodMats'] = $prodMats;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$prodMats = $_SESSION['prodMats'];
|
||||
|
||||
$materiales = $material->EnumerateAll();
|
||||
$materiales = $util->EncodeResult($materiales);
|
||||
|
||||
$smarty->assign('prodMats', $prodMats);
|
||||
$smarty->assign('materiales', $materiales);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-materiales.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteMaterial':
|
||||
|
||||
$key = $_POST['k'];
|
||||
|
||||
$prodMats = array();
|
||||
|
||||
foreach($_POST['materialId'] as $k => $materialId){
|
||||
$card['materialId'] = $materialId;
|
||||
$card['porcentaje'] = $_POST['porcentaje'][$k];
|
||||
|
||||
$prodMats[$k] = $card;
|
||||
}
|
||||
|
||||
unset($prodMats[$key]);
|
||||
|
||||
$_SESSION['prodMats'] = $prodMats;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$prodMats = $_SESSION['prodMats'];
|
||||
|
||||
$materiales = $material->EnumerateAll();
|
||||
$materiales = $util->EncodeResult($materiales);
|
||||
|
||||
$smarty->assign('prodMats', $prodMats);
|
||||
$smarty->assign('materiales', $materiales);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-materiales.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
240
ajax/productos-subcategorias.php
Executable file
240
ajax/productos-subcategorias.php
Executable file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'addSubcategory':
|
||||
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
|
||||
$atributos = $atributo->EnumerateAll2();
|
||||
$atributos = $util->EncodeResult($atributos);
|
||||
|
||||
$smarty->assign('prodCatId',$prodCatId);
|
||||
$smarty->assign('atributos',$atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-producto-subcategoria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveSubcategory':
|
||||
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$prodSubcat->setNombre($_POST['name']);
|
||||
|
||||
$prodSubcatId = $prodSubcat->Save();
|
||||
|
||||
if(!$prodSubcatId)
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
//Guardamos los atributos
|
||||
|
||||
$atributos = (count($_POST['atributos']) == 0) ? array() : $_POST['atributos'];
|
||||
|
||||
foreach($atributos as $id){
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$prodSubcat->setProdSubcatId($prodSubcatId);
|
||||
$prodSubcat->setAtributoId($id);
|
||||
|
||||
$prodSubcat->SaveAtributo();
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
echo $prodCatId;
|
||||
echo '[#]';
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $res){
|
||||
|
||||
$res['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $val){
|
||||
$atributo->setAtributoId($val['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
|
||||
$res['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $res;
|
||||
}
|
||||
$item['subcategorias'] = $subcategorias;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-subcategorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editSubcategory':
|
||||
|
||||
$prodSubcat->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$info = $prodSubcat->Info();
|
||||
|
||||
$info['nombre'] = utf8_encode($info['nombre']);
|
||||
|
||||
$resAtributos = $atributo->EnumerateAll2();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $res){
|
||||
|
||||
$prodSubcat->setAtributoId($res['atributoId']);
|
||||
if($prodSubcat->ExistAtributo())
|
||||
$res['checked'] = 1;
|
||||
else
|
||||
$res['checked'] = 0;
|
||||
|
||||
$res['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$atributos[] = $res;
|
||||
}
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('atributos',$atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-producto-subcategoria-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditSubcategory':
|
||||
|
||||
$prodSubcatId = $_POST['prodSubcatId'];
|
||||
|
||||
$prodSubcat->setProdSubcatId($prodSubcatId);
|
||||
$prodSubcat->setNombre($_POST['name']);
|
||||
|
||||
$info = $prodSubcat->Info();
|
||||
$prodCatId = $info['prodCatId'];
|
||||
|
||||
if(!$prodSubcat->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
//Eliminamos los atributos
|
||||
|
||||
$prodSubcat->DeleteAtributos();
|
||||
|
||||
//Guardamos los atributos
|
||||
|
||||
$atributos = (count($_POST['atributos']) == 0) ? array() : $_POST['atributos'];
|
||||
|
||||
foreach($atributos as $id){
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$prodSubcat->setProdSubcatId($prodSubcatId);
|
||||
$prodSubcat->setAtributoId($id);
|
||||
|
||||
$prodSubcat->SaveAtributo();
|
||||
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
echo $prodCatId;
|
||||
echo '[#]';
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $res){
|
||||
|
||||
$res['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $val){
|
||||
$atributo->setAtributoId($val['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
|
||||
$res['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $res;
|
||||
}
|
||||
$item['subcategorias'] = $subcategorias;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-subcategorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteSubcategory':
|
||||
|
||||
$prodSubcat->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$info = $prodSubcat->Info();
|
||||
$prodCatId = $info['prodCatId'];
|
||||
|
||||
if(!$prodSubcat->Delete())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
echo $prodCatId;
|
||||
echo '[#]';
|
||||
|
||||
$prodSubcat->setProdCatId($prodCatId);
|
||||
$resSubcats = $prodSubcat->EnumerateAll();
|
||||
|
||||
$subcategorias = array();
|
||||
foreach($resSubcats as $res){
|
||||
|
||||
$res['nombre'] = utf8_encode($res['nombre']);
|
||||
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->GetAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $val){
|
||||
$atributo->setAtributoId($val['atributoId']);
|
||||
$atributos[] = utf8_encode($atributo->GetNameById());
|
||||
}
|
||||
|
||||
$res['atributos'] = implode(', ',$atributos);
|
||||
|
||||
$subcategorias[] = $res;
|
||||
}
|
||||
$item['subcategorias'] = $subcategorias;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-subcategorias.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
614
ajax/productos.php
Executable file
614
ajax/productos.php
Executable file
@@ -0,0 +1,614 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case "saveProducto":
|
||||
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
$producto->setProveedorId($_POST['proveedorId']);
|
||||
$producto->setProdCatId($_POST['prodCatId']);
|
||||
$producto->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$producto->setModelo($_POST['modelo']);
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$producto->setConTallaId($_POST['conTallaId']);
|
||||
$producto->setDescripcion(urldecode($_POST['descripcion']));
|
||||
$producto->setTemporadaId($_POST['temporadaId']);
|
||||
$producto->setCosto($_POST['costo']);
|
||||
$producto->setPrecioVentaIva($_POST['precioVentaIva']);
|
||||
$producto->setUtilidad($_POST['utilidad']);
|
||||
$producto->setTmpImg($_POST['tmpImg']);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
|
||||
//Checamos los materiales
|
||||
|
||||
if(count($_POST['materialId']) == 0)
|
||||
$_POST['materialId'] = array();
|
||||
|
||||
$totalPorc = 0;
|
||||
foreach($_POST['materialId'] as $k => $materialId){
|
||||
$porcentaje = $_POST['porcentaje'][$k];
|
||||
|
||||
$producto->setMaterialId($materialId);
|
||||
$producto->setPorcentaje($porcentaje);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$totalPorc += $porcentaje;
|
||||
}
|
||||
|
||||
//Checamos el porcentaje total de los materiales
|
||||
|
||||
if($totalPorc > 100){
|
||||
|
||||
$util->setError(20052, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
|
||||
}elseif($totalPorc < 100){
|
||||
|
||||
$util->setError(20053, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
//Guardamos los Codigos de Barra
|
||||
|
||||
$codigo = $_POST['codigo'];
|
||||
if(count($codigo) == 0)
|
||||
$codigo = array();
|
||||
|
||||
if(count($_POST['tallas']) == 0){
|
||||
//$producto->setTallas('');
|
||||
$_POST['tallas'] = array();
|
||||
}
|
||||
|
||||
if(count($_POST['colores']) == 0){
|
||||
//$producto->setColores('');
|
||||
$_POST['colores'] = array();
|
||||
}
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$codigos = array();
|
||||
foreach($_POST['tallas'] as $tallaId){
|
||||
|
||||
$atribVal->setAtribValId($tallaId);
|
||||
$nomTalla = $atribVal->GetNameById();
|
||||
|
||||
foreach($_POST['colores'] as $colorId){
|
||||
|
||||
$codigoBarra = trim($codigo[$tallaId][$colorId]);
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
|
||||
$codigos[] = strtoupper($codigoBarra);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}//if
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
//Verificamos si existen algun codigo dentro de los productos
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
if($producto->GetProductIdByCodigo()){
|
||||
$util->setError(20061, 'error', '', $code);
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}//if
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case "saveEditProducto":
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
$producto->setProveedorId($_POST['proveedorId']);
|
||||
$producto->setProdCatId($_POST['prodCatId']);
|
||||
$producto->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$producto->setModelo($_POST['modelo']);
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$producto->setConTallaId($_POST['conTallaId']);
|
||||
$producto->setTemporadaId($_POST['temporadaId']);
|
||||
$producto->setDescripcion(urldecode($_POST['descripcion']));
|
||||
$producto->setCosto($_POST['costo']);
|
||||
$producto->setPrecioVentaIva($_POST['precioVentaIva']);
|
||||
$producto->setUtilidad($_POST['utilidad']);
|
||||
|
||||
if($productoId > 11236)
|
||||
$producto->setTmpImg($_POST['tmpImg']);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else{
|
||||
|
||||
//Checamos los materiales
|
||||
|
||||
if(count($_POST['materialId']) == 0)
|
||||
$_POST['materialId'] = array();
|
||||
|
||||
$totalPorc = 0;
|
||||
foreach($_POST['materialId'] as $k => $materialId){
|
||||
$porcentaje = $_POST['porcentaje'][$k];
|
||||
|
||||
$producto->setMaterialId($materialId);
|
||||
$producto->setPorcentaje($porcentaje);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$totalPorc += $porcentaje;
|
||||
}
|
||||
|
||||
//Checamos el porcentaje total de los materiales
|
||||
|
||||
if($totalPorc > 100){
|
||||
|
||||
$util->setError(20052, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
//Guardamos los Codigos de Barra
|
||||
|
||||
$codigo = $_POST['codigo'];
|
||||
if(count($codigo) == 0)
|
||||
$codigo = array();
|
||||
|
||||
if(count($_POST['tallas']) == 0){
|
||||
//$producto->setTallas('');
|
||||
$_POST['tallas'] = array();
|
||||
}
|
||||
|
||||
if(count($_POST['colores']) == 0){
|
||||
//$producto->setColores('');
|
||||
$_POST['colores'] = array();
|
||||
}
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$codigos = array();
|
||||
foreach($_POST['tallas'] as $tallaId){
|
||||
|
||||
$atribVal->setAtribValId($tallaId);
|
||||
$nomTalla = $atribVal->GetNameById();
|
||||
|
||||
foreach($_POST['colores'] as $colorId){
|
||||
|
||||
$codigoBarra = trim($codigo[$tallaId][$colorId]);
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
|
||||
$codigos[] = strtoupper($codigoBarra);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}//if
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
//Verificamos si existen algun codigo dentro de los productos
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$idProd = $producto->GetProductIdByCodigo();
|
||||
if($idProd > 0 && $productoId != $idProd){
|
||||
$util->setError(20061, 'error', '', $code);
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}//if
|
||||
|
||||
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case "deleteProducto":
|
||||
|
||||
$producto->setProductoId($_POST['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
if($producto->Baja()){
|
||||
|
||||
if($infP['imagen'] != '')
|
||||
@unlink(DOC_ROOT.'/images/productos/'.$infP['imagen']);
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
|
||||
echo '[#]';
|
||||
$productos = $producto->Enumerate();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
|
||||
$res['modelo'] = utf8_encode($res['modelo']);
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
|
||||
$res['proveedor'] = utf8_encode($infPv['nombre']);
|
||||
$res['noProv'] = $infPv['noProv'];
|
||||
|
||||
$prodCat->setProdCatId($res['prodCatId']);
|
||||
$res['departamento'] = utf8_encode($prodCat->GetNameById());
|
||||
|
||||
if($res['prodSubcatId']){
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$res['linea'] = utf8_encode($prodSubcat->GetNameById());
|
||||
}
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'loadSubcats':
|
||||
|
||||
$prodSubcat->setProdCatId($_POST['prodCatId']);
|
||||
$subcategorias = $prodSubcat->EnumerateAll();
|
||||
$subcategorias = $util->EncodeResult($subcategorias);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('subcategorias', $subcategorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumProdSubcat.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadTallas':
|
||||
|
||||
$conTallaId = $_POST['conTallaId'];
|
||||
|
||||
$conValor->setConTallaId($conTallaId);
|
||||
$resTallas = $conValor->EnumerateAll();
|
||||
|
||||
$tallas = array();
|
||||
foreach($resTallas as $res){
|
||||
|
||||
$atribVal->setAtribValId($res['tallaId']);
|
||||
$res['nombre'] = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$tallas[] = $res;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumTallasProd.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "search":
|
||||
|
||||
$producto->setNoProveedor($_POST['noProveedor']);
|
||||
$producto->setProveedorId($_POST['proveedorId2']);
|
||||
$producto->setDescripcion($_POST['word']);
|
||||
$producto->setProdCatId($_POST['prodCatId']);
|
||||
$producto->setCodigoBarra($_POST['codigoBarra']);
|
||||
|
||||
$productos = $producto->Search();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
|
||||
$res['proveedor'] = $infPv['nombre'];
|
||||
$res['noProv'] = utf8_encode($infPv['noProv']);
|
||||
|
||||
$prodCat->setProdCatId($res['prodCatId']);
|
||||
$res['departamento'] = utf8_encode($prodCat->GetNameById());
|
||||
|
||||
if($res['prodSubcatId']){
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$res['linea'] = utf8_encode($prodSubcat->GetNameById());
|
||||
}
|
||||
|
||||
$res['modelo'] = utf8_encode($res['modelo']);
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos', $productos );
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "searchDuplicados":
|
||||
|
||||
$producto->setNoProveedor($_POST['noProveedor']);
|
||||
$producto->setProveedorId($_POST['proveedorId2']);
|
||||
$producto->setDescripcion($_POST['word']);
|
||||
$producto->setProdCatId($_POST['prodCatId']);
|
||||
$producto->setCodigoBarra($_POST['codigoBarra']);
|
||||
|
||||
$productos = $producto->SearchDuplicados();
|
||||
|
||||
$items = array();
|
||||
foreach($productos['items'] as $res){
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
|
||||
$res['proveedor'] = $infPv['nombre'];
|
||||
$res['noProv'] = utf8_encode($infPv['noProv']);
|
||||
|
||||
$prodCat->setProdCatId($res['prodCatId']);
|
||||
$res['departamento'] = utf8_encode($prodCat->GetNameById());
|
||||
|
||||
if($res['prodSubcatId']){
|
||||
$prodSubcat->setProdSubcatId($res['prodSubcatId']);
|
||||
$res['linea'] = utf8_encode($prodSubcat->GetNameById());
|
||||
}
|
||||
|
||||
$res['modelo'] = utf8_encode($res['modelo']);
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$productos['items'] = $items;
|
||||
|
||||
$smarty->assign('productos', $productos );
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-duplicados.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadBarCodes':
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$codigoBarra = trim($_POST['codigoBarra']);
|
||||
|
||||
if(count($_POST['tallas']) == 0)
|
||||
$_POST['tallas'] = array();
|
||||
|
||||
if(count($_POST['colores']) == 0)
|
||||
$_POST['colores'] = array();
|
||||
|
||||
$codigos = array();
|
||||
foreach($_POST['tallas'] as $tallaId){
|
||||
|
||||
$atribVal->setAtribValId($tallaId);
|
||||
$nomTalla = $atribVal->GetNameById();
|
||||
|
||||
foreach($_POST['colores'] as $colorId){
|
||||
|
||||
$atribVal->setAtribValId($colorId);
|
||||
|
||||
$card['tallaId'] = $tallaId;
|
||||
$card['colorId'] = $colorId;
|
||||
$card['nombre'] = utf8_encode($nomTalla.' '.$atribVal->GetNameById());
|
||||
|
||||
$code = '';
|
||||
if($productoId){
|
||||
$producto->setProductoId($productoId);
|
||||
$producto->setTallaId($tallaId);
|
||||
$producto->setColorId($colorId);
|
||||
|
||||
$code = $producto->GetCodigoBarra();
|
||||
}
|
||||
|
||||
$card['codigo'] = $codigoBarra;
|
||||
|
||||
$codigos[] = $card;
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('codigos', $codigos);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/productos-codigos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'checkMaterials':
|
||||
|
||||
if(count($_POST['materialId']) == 0)
|
||||
$_POST['materialId'] = array();
|
||||
|
||||
$totalPorc = 0;
|
||||
foreach($_POST['materialId'] as $k => $materialId){
|
||||
|
||||
$porcentaje = $_POST['porcentaje'][$k];
|
||||
|
||||
$producto->setMaterialId($materialId);
|
||||
$producto->setPorcentaje($porcentaje);
|
||||
|
||||
if(!$producto->SaveTemp()){
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$totalPorc += $porcentaje;
|
||||
}
|
||||
|
||||
//Checamos el porcentaje total de los materiales
|
||||
|
||||
if($totalPorc > 100){
|
||||
|
||||
$util->setError(20052, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
|
||||
}elseif($totalPorc < 100){
|
||||
|
||||
$util->setError(20053, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'loadAtributos':
|
||||
|
||||
$prodSubcat->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$resAtributos = $prodSubcat->EnumAtributos();
|
||||
|
||||
$atributos = array();
|
||||
foreach($resAtributos as $res){
|
||||
$card = $res;
|
||||
|
||||
$atributo->setAtributoId($res['atributoId']);
|
||||
$card['nombre'] = utf8_encode($atributo->GetNameById());
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$atributos[] = $card;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumAtributos.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'calcUtilidad':
|
||||
|
||||
$precioVenta = $_POST['precioVenta'];
|
||||
$costo = $_POST['costo'];
|
||||
|
||||
$utilidad = $precioVenta - $costo;
|
||||
|
||||
$porcUtilidad = ($utilidad * 100) / $costo;
|
||||
|
||||
echo 'ok[#]';
|
||||
echo number_format($utilidad,2,'.','');
|
||||
echo '[#]';
|
||||
echo number_format($porcUtilidad,2,'.',',');
|
||||
|
||||
break;
|
||||
|
||||
case 'calcPrecioSinIva':
|
||||
|
||||
$precioVentaIva = $_POST['precioVentaIva'];
|
||||
|
||||
$precioVenta = 0;
|
||||
if($precioVentaIva != ''){
|
||||
$precioVenta = $precioVentaIva / 1.16;
|
||||
$precioVenta = number_format($precioVenta,2,'.','');
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $precioVenta;
|
||||
|
||||
break;
|
||||
|
||||
case 'fillInfoProd':
|
||||
|
||||
$producto->setProductoId($_POST['productoId']);
|
||||
$info = $producto->Info();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $info['productoId'];
|
||||
echo '[#]';
|
||||
echo utf8_encode($info['modelo']);
|
||||
|
||||
break;
|
||||
|
||||
case 'fillInfoProdFact':
|
||||
|
||||
$producto->setProdItemId($_POST['prodItemId']);
|
||||
$info = $producto->GetInfoItemById();
|
||||
|
||||
$producto->setProductoId($info['productoId']);
|
||||
$infP = $producto->Info();
|
||||
|
||||
$atribVal->setAtribValId($info['tallaId']);
|
||||
$res['talla'] = $atribVal->GetNameById();
|
||||
|
||||
$atribVal->setAtribValId($info['colorId']);
|
||||
$res['color'] = $atribVal->GetNameById();
|
||||
|
||||
$descripcion = $infP['modelo'].' '.$res['talla'].' '.$res['color'];
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $info['codigoBarra'];
|
||||
echo '[#]';
|
||||
echo 'Pieza';
|
||||
echo '[#]';
|
||||
echo $infP['precioVentaIva'];
|
||||
echo '[#]';
|
||||
echo utf8_encode($descripcion);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
1043
ajax/promociones.php
Executable file
1043
ajax/promociones.php
Executable file
File diff suppressed because it is too large
Load Diff
313
ajax/proveedores.php
Executable file
313
ajax/proveedores.php
Executable file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'addProveedor':
|
||||
|
||||
$noProv = $proveedor->GetLastNoProv();
|
||||
|
||||
$smarty->assign('noProv', $noProv);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-proveedor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveProveedor':
|
||||
|
||||
$noProv = intval($_POST['noProv']);
|
||||
|
||||
if($noProv == 0){
|
||||
$util->setError(20117,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$proveedor->setNoProv($noProv);
|
||||
if($proveedor->ExistNoProv()){
|
||||
$util->setError(20116,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$proveedor->setRfc($_POST['rfc']);
|
||||
$proveedor->setNombre($_POST['nombre']);
|
||||
|
||||
$proveedor->setNombreVtas($_POST['nombreVtas']);
|
||||
$proveedor->setTelefonoVtas($_POST['telefonoVtas']);
|
||||
$proveedor->setCelularVtas($_POST['celularVtas']);
|
||||
$proveedor->setEmailVtas($_POST['emailVtas']);
|
||||
|
||||
$proveedor->setNombrePagos($_POST['nombrePagos']);
|
||||
$proveedor->setTelefonoPagos($_POST['telefonoPagos']);
|
||||
$proveedor->setCelularPagos($_POST['celularPagos']);
|
||||
$proveedor->setEmailPagos($_POST['emailPagos']);
|
||||
|
||||
$proveedor->setNombreEnt($_POST['nombreEnt']);
|
||||
$proveedor->setTelefonoEnt($_POST['telefonoEnt']);
|
||||
$proveedor->setCelularEnt($_POST['celularEnt']);
|
||||
$proveedor->setEmailEnt($_POST['emailEnt']);
|
||||
|
||||
$proveedor->setCalle($_POST['calle']);
|
||||
$proveedor->setNoExt($_POST['noExt']);
|
||||
$proveedor->setNoInt($_POST['noInt']);
|
||||
$proveedor->setReferencia($_POST['referencia']);
|
||||
$proveedor->setColonia($_POST['colonia']);
|
||||
$proveedor->setLocalidad($_POST['localidad']);
|
||||
$proveedor->setMunicipio($_POST['municipio']);
|
||||
$proveedor->setCodigoPostal($_POST['codigoPostal']);
|
||||
$proveedor->setEstado($_POST['estado']);
|
||||
$proveedor->setPais($_POST['pais']);
|
||||
|
||||
$proveedor->setBanco($_POST['banco']);
|
||||
$proveedor->setNoCuenta($_POST['noCuenta']);
|
||||
$proveedor->setClabe($_POST['clabe']);
|
||||
$proveedor->setAlmacen($_POST['almacen']);
|
||||
$proveedor->setPlazo($_POST['plazo']);
|
||||
|
||||
$proveedor->setPublicidad($_POST['publicidad']);
|
||||
$proveedor->setFlete($_POST['flete']);
|
||||
$proveedor->setDesarrollo($_POST['desarrollo']);
|
||||
$proveedor->setEspecial($_POST['especial']);
|
||||
|
||||
$proveedor->setCompraFirme($_POST['compraFirme']);
|
||||
|
||||
if(!$proveedor->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$proveedores = $proveedor->Enumerate();
|
||||
$proveedores['items'] = $util->EncodeResult($proveedores['items']);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/proveedores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editProveedor':
|
||||
|
||||
$proveedor->setProveedorId($_POST['id']);
|
||||
$infP = $proveedor->Info();
|
||||
$infP = $util->EncodeRow($infP);
|
||||
|
||||
$smarty->assign('post', $infP);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-proveedor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditProveedor':
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
$noProv = intval($_POST['noProv']);
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$infP = $proveedor->Info();
|
||||
|
||||
if($infP['noProv'] != $noProv){
|
||||
|
||||
if($noProv == 0){
|
||||
$util->setError(20117,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$proveedor->setNoProv($noProv);
|
||||
if($proveedor->ExistNoProv()){
|
||||
$util->setError(20116,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
}//if
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$proveedor->setNoProv($noProv);
|
||||
$proveedor->setRfc($_POST['rfc']);
|
||||
$proveedor->setNombre($_POST['nombre']);
|
||||
|
||||
$proveedor->setNombreVtas($_POST['nombreVtas']);
|
||||
$proveedor->setTelefonoVtas($_POST['telefonoVtas']);
|
||||
$proveedor->setCelularVtas($_POST['celularVtas']);
|
||||
$proveedor->setEmailVtas($_POST['emailVtas']);
|
||||
|
||||
$proveedor->setNombrePagos($_POST['nombrePagos']);
|
||||
$proveedor->setTelefonoPagos($_POST['telefonoPagos']);
|
||||
$proveedor->setCelularPagos($_POST['celularPagos']);
|
||||
$proveedor->setEmailPagos($_POST['emailPagos']);
|
||||
|
||||
$proveedor->setNombreEnt($_POST['nombreEnt']);
|
||||
$proveedor->setTelefonoEnt($_POST['telefonoEnt']);
|
||||
$proveedor->setCelularEnt($_POST['celularEnt']);
|
||||
$proveedor->setEmailEnt($_POST['emailEnt']);
|
||||
|
||||
$proveedor->setCalle($_POST['calle']);
|
||||
$proveedor->setNoExt($_POST['noExt']);
|
||||
$proveedor->setNoInt($_POST['noInt']);
|
||||
$proveedor->setReferencia($_POST['referencia']);
|
||||
$proveedor->setColonia($_POST['colonia']);
|
||||
$proveedor->setLocalidad($_POST['localidad']);
|
||||
$proveedor->setMunicipio($_POST['municipio']);
|
||||
$proveedor->setCodigoPostal($_POST['codigoPostal']);
|
||||
$proveedor->setEstado($_POST['estado']);
|
||||
$proveedor->setPais($_POST['pais']);
|
||||
|
||||
$proveedor->setBanco($_POST['banco']);
|
||||
$proveedor->setNoCuenta($_POST['noCuenta']);
|
||||
$proveedor->setClabe($_POST['clabe']);
|
||||
$proveedor->setAlmacen($_POST['almacen']);
|
||||
$proveedor->setPlazo($_POST['plazo']);
|
||||
|
||||
$proveedor->setPublicidad($_POST['publicidad']);
|
||||
$proveedor->setFlete($_POST['flete']);
|
||||
$proveedor->setDesarrollo($_POST['desarrollo']);
|
||||
$proveedor->setEspecial($_POST['especial']);
|
||||
|
||||
$proveedor->setCompraFirme($_POST['compraFirme']);
|
||||
|
||||
if(!$proveedor->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$proveedores = $proveedor->Enumerate();
|
||||
$proveedores['items'] = $util->EncodeResult($proveedores['items']);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/proveedores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteProveedor':
|
||||
|
||||
$proveedor->setProveedorId($_POST['id']);
|
||||
|
||||
if($proveedor->Baja())
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$proveedores = $proveedor->Enumerate();
|
||||
$proveedores['items'] = $util->EncodeResult($proveedores['items']);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/proveedores.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'viewProveedor':
|
||||
|
||||
$proveedor->setProveedorId($_POST['id']);
|
||||
$infP = $proveedor->Info();
|
||||
$infP = $util->EncodeRow($infP);
|
||||
|
||||
$smarty->assign('post', $infP);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/detalles-proveedor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
|
||||
$proveedor->setNoProv($_POST['noProv']);
|
||||
$proveedor->setNombre($_POST['word']);
|
||||
$proveedores = $proveedor->Search();
|
||||
|
||||
$proveedores['items'] = $util->EncodeResult($proveedores['items']);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/proveedores.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'fillInfoProv':
|
||||
|
||||
$proveedor->setProveedorId($_POST['proveedorId']);
|
||||
$info = $proveedor->Info();
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $info['proveedorId'];
|
||||
echo '[#]';
|
||||
echo utf8_encode($info['nombre']);
|
||||
echo '[#]';
|
||||
echo $info['publicidad'];
|
||||
echo '[#]';
|
||||
echo $info['flete'];
|
||||
echo '[#]';
|
||||
echo $info['desarrollo'];
|
||||
echo '[#]';
|
||||
echo $info['especial'];
|
||||
|
||||
break;
|
||||
|
||||
case 'calificarProv':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$infP = $pedido->Info();
|
||||
|
||||
$info['pedidoId'] = $pedidoId;
|
||||
$info['noPedido'] = $infP['noPedido'];
|
||||
$info['calificacion'] = $infP['calificacion'];
|
||||
$info['comentario'] = utf8_encode($infP['comentCalif']);
|
||||
|
||||
$proveedor->setProveedorId($infP['proveedorId']);
|
||||
$info['proveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/calificar-proveedor-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveCalifProv':
|
||||
|
||||
$proveedor->setPedidoId($_POST['pedidoId']);
|
||||
$proveedor->setCalificacion($_POST['calificacion']);
|
||||
$proveedor->setComentario($_POST['comentario']);
|
||||
|
||||
if(!$proveedor->UpdateCalifPedido())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
93
ajax/reportes-buenfin-prov.php
Executable file
93
ajax/reportes-buenfin-prov.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'buenFinProv':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$idSucursal = $_POST['idSucursal'];
|
||||
$idProveedor = $_POST['idProveedor'];
|
||||
$fechaIni = date('Y-m-d',strtotime($_POST['fechaI']));
|
||||
$fechaFin = date('Y-m-d',strtotime($_POST['fechaF']));
|
||||
|
||||
$promocionId = $promocion->GetBuenFinId();
|
||||
|
||||
if($idProveedor)
|
||||
$sqlFilter = ' AND prov.proveedorId = '.$idProveedor;
|
||||
|
||||
$reportes->setIdSuc($idSucursal);
|
||||
$resSuc = $reportes->EnumSucursales();
|
||||
|
||||
$totales['prods'] = 0;
|
||||
$totales['costo'] = 0;
|
||||
$sucursales = array();
|
||||
foreach($resSuc as $res){
|
||||
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$sql = 'SELECT prov.proveedorId, prov.nombre, SUM(vp.cantidad) AS totalProds,
|
||||
SUM(vp.cantidad * p.costo) AS totalCosto
|
||||
FROM venta AS v, ventaProducto AS vp, producto AS p, proveedor AS prov
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND p.proveedorId = prov.proveedorId
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
AND prov.baja = "0"
|
||||
AND vp.promocionId = "'.$promocionId.'"
|
||||
AND v.fecha >= "'.$fechaIni.' 00:00:00"
|
||||
AND v.fecha <= "'.$fechaFin.' 23:59:59"
|
||||
AND v.sucursalId = "'.$sucursalId.'"
|
||||
'.$sqlFilter.'
|
||||
GROUP BY prov.proveedorId';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$res['proveedores'] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = 'SELECT SUM(vp.cantidad) AS totalProds,
|
||||
SUM(vp.cantidad * p.costo) AS totalCosto
|
||||
FROM venta AS v, ventaProducto AS vp, producto AS p, proveedor AS prov
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND p.proveedorId = prov.proveedorId
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
AND prov.baja = "0"
|
||||
AND vp.promocionId = "'.$promocionId.'"
|
||||
AND v.fecha >= "'.$fechaIni.' 00:00:00"
|
||||
AND v.fecha <= "'.$fechaFin.' 23:59:59"
|
||||
'.$sqlFilter.'
|
||||
AND v.sucursalId = "'.$sucursalId.'"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$res['totalProds'] = $row['totalProds'];
|
||||
$res['totalCosto'] = $row['totalCosto'];
|
||||
|
||||
$totales['prods'] += $row['totalProds'];
|
||||
$totales['costo'] += $row['totalCosto'];
|
||||
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$smarty->assign('totales',$totales);
|
||||
$smarty->assign('sucursales',$sucursales);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-buenfin-prov.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo 'Tiempo de Ejecución: ';
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
32
ajax/reportes-compras.php
Executable file
32
ajax/reportes-compras.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
//session_start();
|
||||
$Usr = $user->Info();
|
||||
echo "en mantenimiento";exit();
|
||||
$smarty->assign('Usr', $Usr); /* if(isset($_POST['action'])) $_POST['type'] = $_POST['action'];*/
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "tipoComprado"://reporte de productos mas comprados
|
||||
$reportes->setFechaI($_POST['fechaI']);
|
||||
$reportes->setFechaF($_POST['fechaF']);
|
||||
$smarty->assign("fi",$_POST['fechaI']);
|
||||
$smarty->assign("ff",$_POST['fechaF']);
|
||||
$reportes->setOrden($_POST['orden']);
|
||||
if($reportes->validaF($_POST['fechaI'],$_POST['fechaF']))
|
||||
{
|
||||
$resProdCom=$reportes->ProductosComprados();
|
||||
$resProdCom=$util->DecodeUrlResult($resProdCom);
|
||||
$smarty->assign("resProdCom",$resProdCom);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-productosCompra.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<div style=\"text-align:center\">fecha inicial no puede ser mayor que fecha final</div>";
|
||||
}
|
||||
break;//fin reporte de productos mas comprados
|
||||
}//switch
|
||||
|
||||
?>
|
||||
55
ajax/reportes-cuentaspagar.php
Executable file
55
ajax/reportes-cuentaspagar.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
//session_start();
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr); /* if(isset($_POST['action'])) $_POST['type'] = $_POST['action'];*/
|
||||
//reportes-cuentaspagar
|
||||
echo "en mantenimiento";exit();
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "tipoCuentasPend"://reporte General de ventas
|
||||
//$reportes->setFechaI(date('Y-m-d',strtotime($_POST['fechaI'])));
|
||||
//$reportes->setFechaF(date('Y-m-d',strtotime($_POST['fechaF'])));
|
||||
$reportes->setFechaI($_POST['fechaI']);
|
||||
$reportes->setFechaF($_POST['fechaF']);
|
||||
$smarty->assign("fi",$_POST['fechaI']);
|
||||
$smarty->assign("ff",$_POST['fechaF']);
|
||||
|
||||
$reportes->setUserUsuario($Usr['usuarioId']);
|
||||
if($Usr['type']=="admin")
|
||||
{
|
||||
$reportes->setTypeUser("admin");
|
||||
$reportes->setIdSuc($Usr['sucursalId']);
|
||||
}
|
||||
if($reportes->validaF($_POST['fechaI'],$_POST['fechaF']))
|
||||
{
|
||||
$reportes->setProveedor($_POST['proveedor']);
|
||||
$resCuentasPP=$reportes->cuentasPorpagar();
|
||||
foreach($resCuentasPP as $rCuentasPP)
|
||||
{
|
||||
$reportes->setPedidoId($rCuentasPP['noPedido']);
|
||||
$rCuentasPP['fecha']=date('d-m-Y H:i:s',strtotime($rCuentasPP['fecha']));
|
||||
$rCuentasPP['bonificaciones']=$reportes->bonificaciones();
|
||||
if($rCuentasPP['saldo']==NULL){$rCuentasPP['saldo']=$rCuentasPP['total'];}
|
||||
if($rCuentasPP['totalparcial']==NULL){$rCuentasPP['totalparcial']="0.00";}
|
||||
$rCuentasPP['saldoTotal'] =$rCuentasPP['saldo'] - $rCuentasPP['bonificaciones'];
|
||||
$resultado[]=$rCuentasPP;
|
||||
}
|
||||
$smarty->assign("resCuentasPP",$resultado);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-cuentaspagar.tpl');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<div style=\"text-align:center\">fecha inicial no puede ser mayor que fecha final</div>";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
0
ajax/reportes-devcedis
Executable file
0
ajax/reportes-devcedis
Executable file
85
ajax/reportes-devcedis - Copy.php
Executable file
85
ajax/reportes-devcedis - Copy.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'search':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$fechaIni = trim($_POST['fechaI']);
|
||||
$fechaFin = trim($_POST['fechaF']);
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
|
||||
if($fechaIni == ''){
|
||||
$util->setError(20114,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaFin == ''){
|
||||
$util->setError(20115,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
if($sucursalId)
|
||||
$sqlAdd = ' AND dp.sucursalId = "'.$sucursalId.'"';
|
||||
|
||||
echo $sql = 'SELECT dp.*, d.fecha, s.nombre AS sucursal, prod.codigoBarra, prod.modelo AS producto,
|
||||
prod.costo, prov.nombre AS proveedor, (prod.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND DATE(d.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(d.fecha) <= "'.$fechaFin.'"
|
||||
'.$sqlAdd;
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$productos = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = 'SELECT SUM(dp.cantidad) AS totalCantidad, SUM(prod.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND DATE(d.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(d.fecha) <= "'.$fechaFin.'"
|
||||
'.$sqlAdd;
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$totalProds = $row['totalCantidad'];
|
||||
$totalTotal = $row['total'];
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('totalProds', $totalProds);
|
||||
$smarty->assign('totalTotal', $totalTotal);
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('devoluciones', $productos);
|
||||
// print_r($productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-devcedis.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
214
ajax/reportes-devcedis.php
Executable file
214
ajax/reportes-devcedis.php
Executable file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/*
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'search':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$fechaIni = trim($_POST['fechaI']);
|
||||
$fechaFin = trim($_POST['fechaF']);
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
|
||||
if($fechaIni == ''){
|
||||
$util->setError(20114,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaFin == ''){
|
||||
$util->setError(20115,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
$reportes->setFechaIni($fechaIni);
|
||||
$reportes->setFechaFin($fechaFin);
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
|
||||
if($sucursalId)
|
||||
$sqlAdd = ' AND sucursalId = "'.$sucursalId.'"';
|
||||
|
||||
$sql = 'SELECT * FROM devolucionCedis WHERE
|
||||
|
||||
AND DATE(d.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(d.fecha) <= "'.$fechaFin.'
|
||||
AND '.$sqlAdd;
|
||||
$resDevs = $util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
|
||||
// $resDevs = $reportes->DevolucionesCedis();
|
||||
|
||||
$totalProds = 0;
|
||||
$totalTotal = 0;
|
||||
$devoluciones = array();
|
||||
foreach($resDevs as $res){
|
||||
|
||||
$sql = 'SELECT SUM(dp.cantidad) AS totalProds, SUM(p.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, producto p
|
||||
WHERE dp.productoId = p.productoId
|
||||
AND dp.devCedisId = '.$res['devCedisId'];
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$res['totalProds'] = $row['totalProds'];
|
||||
$res['total'] = $row['total'];
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetNameById();
|
||||
|
||||
$sql = 'SELECT dp.*, s.nombre AS sucursal, prod.codigoBarra, prod.modelo AS producto,
|
||||
prod.costo, prov.nombre AS proveedor, (prod.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND dp.devCedisId = '.$res['devCedisId'];
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$res['productos'] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$totalProds += $row['totalProds'];
|
||||
$totalTotal += $row['total'];
|
||||
|
||||
$devoluciones[] = $res;
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('totalProds', $totalProds);
|
||||
$smarty->assign('totalTotal', $totalTotal);
|
||||
$smarty->assign('devoluciones', $devoluciones);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-devcedis.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'search':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$fechaIni = trim($_POST['fechaI']);
|
||||
$fechaFin = trim($_POST['fechaF']);
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
|
||||
if($fechaIni == ''){
|
||||
$util->setError(20114,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaFin == ''){
|
||||
$util->setError(20115,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
if($sucursalId)
|
||||
$sqlAdd = ' AND dp.sucursalId = "'.$sucursalId.'"';
|
||||
|
||||
$sql = 'SELECT SUM(dp.cantidad) AS totalCantidad, dp.*, d.fecha, s.nombre AS sucursal, prod.codigoBarra, prod.modelo AS producto,
|
||||
prod.costo, prov.nombre AS proveedor, (prod.costo * dp.cantidad) AS total, d.usuarioId
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND DATE(d.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(d.fecha) <= "'.$fechaFin.'"
|
||||
'.$sqlAdd.' GROUP BY devCedisId';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$devoluciones = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
foreach($devoluciones as $key => $dev)
|
||||
{
|
||||
$sql = 'SELECT dp.*, d.fecha, s.nombre AS sucursal, prod.codigoBarra, prod.modelo AS producto,
|
||||
prod.costo, prov.nombre AS proveedor
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND dp.devCedisId = "'.$dev["devCedisId"].'"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$devoluciones[$key]["productos"] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = 'SELECT SUM(prod.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND dp.devCedisId = "'.$dev["devCedisId"].'"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$devoluciones[$key]['total'] += $util->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
$usuario->setUsuarioId($dev['usuarioId']);
|
||||
$devoluciones[$key]['usuario'] = $usuario->GetNameById();
|
||||
}
|
||||
|
||||
$sql = 'SELECT SUM(dp.cantidad) AS totalCantidad, SUM(prod.costo * dp.cantidad) AS total
|
||||
FROM devolucionProdCedis dp, devolucionCedis d, sucursal s, producto prod, proveedor prov
|
||||
WHERE dp.devCedisId = d.devCedisId
|
||||
AND dp.sucursalId = s.sucursalId
|
||||
AND dp.productoId = prod.productoId
|
||||
AND prod.proveedorId = prov.proveedorId
|
||||
AND DATE(d.fecha) >= "'.$fechaIni.'"
|
||||
AND DATE(d.fecha) <= "'.$fechaFin.'"
|
||||
'.$sqlAdd;
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$totalProds = $row[''];
|
||||
$totalTotal = $row['total'];
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('totalProds', $totalProds);
|
||||
$smarty->assign('totalTotal', $totalTotal);
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('devoluciones', $devoluciones);
|
||||
// print_r($productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-devcedis.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
?>
|
||||
89
ajax/reportes-faltantes.php
Executable file
89
ajax/reportes-faltantes.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case "search":
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
|
||||
$reportes->setProveedorId($proveedorId);
|
||||
$resProvs = $reportes->EnumAllProv();
|
||||
|
||||
if($proveedorId)
|
||||
$sqlAdd = ' AND proveedorId = "'.$proveedorId.'"';
|
||||
|
||||
$sql = 'SELECT proveedorId, noProv, nombre FROM proveedor
|
||||
WHERE baja = "0" '.$sqlAdd.'
|
||||
ORDER BY nombre ASC';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resProvs = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$total = 0;
|
||||
foreach($resProvs as $val){
|
||||
|
||||
$reportes->setProveedorId($val['proveedorId']);
|
||||
|
||||
$sql = "SELECT e.sucursalId, s.nombre AS sucursal
|
||||
FROM envioRecibir er, envio e, producto p, sucursal s
|
||||
WHERE e.envioId = er.envioId
|
||||
AND e.sucursalId = s.sucursalId
|
||||
AND er.productoId = p.productoId
|
||||
AND p.proveedorId = '".$val['proveedorId']."'
|
||||
AND er.faltantes > 0
|
||||
GROUP BY e.sucursalId";
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resSucursales = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sucursales = array();
|
||||
foreach($resSucursales as $res){
|
||||
|
||||
$sql = "SELECT SUM(er.faltantes) AS faltantes, p.codigoBarra, p.modelo AS producto
|
||||
FROM envioRecibir er, envio e, producto p
|
||||
WHERE e.envioId = er.envioId
|
||||
AND er.productoId = p.productoId
|
||||
AND p.proveedorId = '".$val['proveedorId']."'
|
||||
AND e.sucursalId = '".$res['sucursalId']."'
|
||||
AND er.faltantes > 0
|
||||
GROUP BY er.productoId";
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$res['productos'] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = "SELECT SUM(er.faltantes)
|
||||
FROM envioRecibir er, envio e, producto p
|
||||
WHERE e.envioId = er.envioId
|
||||
AND er.productoId = p.productoId
|
||||
AND p.proveedorId = '".$val['proveedorId']."'
|
||||
AND e.sucursalId = '".$res['sucursalId']."'
|
||||
AND er.faltantes > 0";
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$total += $util->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
$sucursales[] = $res;
|
||||
}
|
||||
$val['sucursales'] = $sucursales;
|
||||
|
||||
$proveedores[] = $val;
|
||||
}
|
||||
|
||||
$smarty->assign('total', $total);
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-faltantes.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
218
ajax/reportes-inventario.php
Executable file
218
ajax/reportes-inventario.php
Executable file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'rInventario':
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
$sucursalId = $_POST['sucursal'];
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
$prodSubcatId = $_POST['prodSubcatId'];
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$resSuc = $reportes->EnumSucursales();
|
||||
|
||||
if($proveedorId)
|
||||
$sqlFilter = ' AND proveedorId = '.$proveedorId;
|
||||
|
||||
$sql = 'SELECT proveedorId FROM proveedor WHERE 1 '.$sqlFilter;
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$dispGral = 0;
|
||||
$totalGral = 0;
|
||||
$totalGralPV = 0;
|
||||
$sucursales = array();
|
||||
foreach($resSuc as $res){
|
||||
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$dispSuc = 0;
|
||||
$totalSuc = 0;
|
||||
$totalSucPV = 0;
|
||||
$productos = array();
|
||||
foreach($proveedores as $prov){
|
||||
|
||||
$proveedorId = $prov['proveedorId'];
|
||||
|
||||
$sql = "SELECT reporte, fecha FROM `reporteInvBest` WHERE proveedorId = ".$proveedorId;
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
if(!$row)
|
||||
continue;
|
||||
|
||||
$reporte = $row['reporte'];
|
||||
$fechaRep = date('d-m-Y',strtotime($row['fecha']));
|
||||
|
||||
$resSucursales = unserialize(urldecode($reporte));
|
||||
|
||||
foreach($resSucursales as $res2){
|
||||
|
||||
if($sucursalId > 0 && $sucursalId != $res2['sucursalId'])
|
||||
continue;
|
||||
|
||||
foreach($res2['productos'] as $prod){
|
||||
|
||||
if($prodCatId > 0 && $prodCatId != $prod['prodCatId'])
|
||||
continue;
|
||||
|
||||
if($prodSubcatId > 0 && $prodSubcatId != $prod['prodSubcatId'])
|
||||
continue;
|
||||
|
||||
$dispSuc += $prod['disponible'];
|
||||
$totalSuc += $prod['total'];
|
||||
$totalSucPV += $prod['totalPV'];
|
||||
|
||||
$dispGral += $prod['disponible'];
|
||||
$totalGral += $prod['total'];
|
||||
$totalGralPV += $prod['totalPV'];
|
||||
|
||||
$productos[] = $prod;
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
}//foreach
|
||||
|
||||
$res['disponible'] = $dispSuc;
|
||||
$res['total'] = $totalSuc;
|
||||
$res['totalPV'] = $totalSucPV;
|
||||
|
||||
$res['productos'] = $productos;
|
||||
|
||||
if(count($productos) > 0)
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totales['disponible'] = $dispGral;
|
||||
$totales['total'] = $totalGral;
|
||||
$totales['totalPV'] = $totalGralPV;
|
||||
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-inventario.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "_rInventario":
|
||||
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
$sucursalId = $_POST['sucursal'];
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
$prodSubcatId = $_POST['prodSubcatId'];
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$resSuc = $reportes->EnumSucursales();
|
||||
|
||||
$sqlFilter = '';
|
||||
if($proveedorId)
|
||||
$sqlFilter = ' AND p.proveedorId = '.$proveedorId;
|
||||
if($prodCatId)
|
||||
$sqlFilter .= ' AND p.prodCatId = '.$prodCatId;
|
||||
if($prodSubcatId)
|
||||
$sqlFilter .= ' AND p.prodSubcatId = '.$prodSubcatId;
|
||||
|
||||
$dispGral = 0;
|
||||
$totalGral = 0;
|
||||
$totalGralPV = 0;
|
||||
$sucursales = array();
|
||||
foreach($resSuc as $res){
|
||||
|
||||
$sql = 'SELECT prov.nombre, p.productoId, p.costo, p.codigoBarra, p.modelo, p.precioVentaIva,
|
||||
SUM( i.cantidad ) AS disponible, (SUM( i.cantidad ) * p.costo) AS total,
|
||||
(SUM( i.cantidad ) * p.precioVentaIva) AS totalPV,
|
||||
prov.nombre AS proveedor
|
||||
FROM producto p, inventario i, proveedor prov
|
||||
WHERE p.productoId = i.productoId
|
||||
AND p.proveedorId = prov.proveedorId
|
||||
AND i.sucursalId = '.$res['sucursalId'].'
|
||||
'.$sqlFilter.'
|
||||
AND i.status = "Disponible"
|
||||
GROUP BY i.productoId
|
||||
ORDER BY p.codigoBarra ASC';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resProductos = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$totalSinDesc = 0;
|
||||
$productos = array();
|
||||
foreach($resProductos as $prod){
|
||||
|
||||
$prod['nombre'] = utf8_encode($prod['nombre']);
|
||||
$prod['modelo'] = utf8_encode($prod['modelo']);
|
||||
|
||||
$inventario->setSucursalId($res['sucursalId']);
|
||||
$inventario->setProductoId($prod['productoId']);
|
||||
$vtasSinDesc = $inventario->VentasDescontadas();
|
||||
|
||||
$totalSinDesc += $vtasSinDesc;
|
||||
$prod['disponible'] -= $vtasSinDesc;
|
||||
|
||||
$productos[] = $prod;
|
||||
}
|
||||
$res['productos'] = $productos;
|
||||
|
||||
//Obtenemos los Totales
|
||||
|
||||
$sql = 'SELECT SUM(i.cantidad) AS disponible, SUM(i.cantidad * p.costo) AS total,
|
||||
SUM(i.cantidad * p.precioVentaIva) AS totalPV
|
||||
FROM producto p, inventario i, proveedor prov
|
||||
WHERE p.productoId = i.productoId
|
||||
AND p.proveedorId = prov.proveedorId
|
||||
AND i.sucursalId = '.$res['sucursalId'].'
|
||||
'.$sqlFilter.'
|
||||
AND i.status = "Disponible"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$row['disponible'] -= $totalSinDesc;
|
||||
|
||||
$res['disponible'] = $row['disponible'];
|
||||
$res['total'] = $row['total'];
|
||||
$res['totalPV'] = $row['totalPV'];
|
||||
|
||||
$dispGral += $row['disponible'];
|
||||
$totalGral += $row['total'];
|
||||
$totalGralPV += $row['totalPV'];
|
||||
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$totales['disponible'] = $dispGral;
|
||||
$totales['total'] = $totalGral;
|
||||
$totales['totalPV'] = $totalGralPV;
|
||||
|
||||
$smarty->assign('totales', $totales);
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-inventario.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'loadSubcats':
|
||||
|
||||
$prodSubcat->setProdCatId($_POST['prodCatId']);
|
||||
$subcategorias = $prodSubcat->EnumerateAll();
|
||||
$subcategorias = $util->EncodeResult($subcategorias);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('subcategorias', $subcategorias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumProdSubcat2.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
110
ajax/reportes-invparcial.php
Executable file
110
ajax/reportes-invparcial.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "addSolicitud":
|
||||
|
||||
$resSuc = $sucursal->GetSucursalesByEmpresaId();
|
||||
$sucursales = $util->DecodeUrlResult($resSuc);
|
||||
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-solicitud-invparcial-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveSolicitud":
|
||||
|
||||
$inventario->setSucursalId2($_POST["sucursalId"]);
|
||||
$inventario->setTipo($_POST["tipo"]);
|
||||
|
||||
if($inventario->ExistReport()){
|
||||
$util->setError(10049,'error');
|
||||
$util->PrintErrors();
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$inventario->SaveReporteParcial())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$reportesInv = $inventario->EnumReporteParcial();
|
||||
|
||||
if(count($reportesInv['items']))
|
||||
$reportesInv['items'] = $util->EncodeResult($reportesInv['items']);
|
||||
|
||||
$items = array();
|
||||
foreach($reportesInv['items'] as $res){
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$reportesInv['items'] = $items;
|
||||
|
||||
$smarty->assign("reportesInv", $reportesInv);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-invparcial.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "deleteSolicitud":
|
||||
|
||||
$inventario->setRepInvParcialId($_POST["id"]);
|
||||
$info = $inventario->InfoInvParcialById();
|
||||
|
||||
if(!$inventario->DeleteReporteParcial())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Eliminamos el archivo generado en reportes de inventario total
|
||||
@unlink(DOC_ROOT.'/reportes/'.$info['archivo']);
|
||||
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$reportesInv = $inventario->EnumReporteParcial();
|
||||
|
||||
if(count($reportesInv['items']))
|
||||
$reportesInv['items'] = $util->EncodeResult($reportesInv['items']);
|
||||
|
||||
$items = array();
|
||||
foreach($reportesInv['items'] as $res){
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$reportesInv['items'] = $items;
|
||||
|
||||
$smarty->assign("reportesInv", $reportesInv);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-invparcial.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
222
ajax/reportes-prod-prov2.php
Executable file
222
ajax/reportes-prod-prov2.php
Executable file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'tipoProdProv':
|
||||
|
||||
$proveedorId = $_POST['idProveedor'];
|
||||
$sucursalId = $_POST['idSucursal'];
|
||||
$orden = $_POST['orden'];
|
||||
$fechaI = $_POST['fechaI'];
|
||||
$fechaF = $_POST['fechaF'];
|
||||
$prodCatId = $_POST['prodCatId'];
|
||||
$prodSubcatId = $_POST['prodSubcatId'];
|
||||
$codigoBarra = $_POST['codigoBarra'];
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$reportes->setFechaI($fechaI);
|
||||
$reportes->setFechaF($fechaF);
|
||||
|
||||
if($orden=="mayor")
|
||||
{
|
||||
$orderBy = "DESC";
|
||||
$mayormenor = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mayormenor = false;
|
||||
$orderBy = "ASC";
|
||||
}
|
||||
|
||||
if($Usr['type']=="admin")
|
||||
$smarty->assign("tipo","admin");
|
||||
if($Usr['type']=="gerente")
|
||||
$smarty->assign("tipo","gerente");
|
||||
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$resSucursales = $reportes->EnumSucursales();
|
||||
|
||||
$global['disponible'] = 0;
|
||||
$global['cedis'] = 0;
|
||||
$global['porLlegar'] = 0;
|
||||
$global['vendidos'] = 0;
|
||||
$global['total'] = 0;
|
||||
|
||||
$totDispGral = 0;
|
||||
$totProdsGral = 0;
|
||||
$totImpGral = 0;
|
||||
$prodGlobal = array();
|
||||
foreach($resSucursales as $res){
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$sqlFilter = '';
|
||||
if($codigoBarra)
|
||||
$sqlFilter .= ' AND p.codigoBarra = "'.$codigoBarra.'"';
|
||||
|
||||
if($proveedorId)
|
||||
$sqlFilter .= ' AND p.proveedorId = '.$proveedorId;
|
||||
|
||||
if($proveedorId)
|
||||
$sqlFilter .= ' AND p.proveedorId = '.$proveedorId;
|
||||
|
||||
if($prodCatId)
|
||||
$sqlFilter .= ' AND p.prodCatId = '.$prodCatId;
|
||||
|
||||
if($prodSubcatId)
|
||||
$sqlFilter .= ' AND p.prodSubcatId = '.$prodSubcatId;
|
||||
|
||||
$sql = 'SELECT p.productoId, p.imagen, p.modelo, p.codigoBarra, p.precioVentaIva AS precioVenta,
|
||||
p.costo, p.proveedorId, p.prodCatId, p.prodSubcatId, SUM(IF( v.ventaId IS NULL , 0, vp.cantidad)) AS vendidos
|
||||
FROM producto AS p
|
||||
LEFT JOIN ventaProducto vp ON vp.productoId = p.productoId
|
||||
LEFT JOIN venta v ON v.ventaId = vp.ventaId
|
||||
AND v.status <> "Cancelado"
|
||||
AND v.fecha >= "'.date('Y-m-d',strtotime($fechaI)).' 00:00:00"
|
||||
AND v.fecha <= "'.date('Y-m-d',strtotime($fechaF)).' 23:59:59"
|
||||
AND v.sucursalId = "'.$sucursalId.'"
|
||||
WHERE 1
|
||||
'.$sqlFilter.'
|
||||
GROUP BY p.productoId ORDER BY vendidos '.$orderBy;
|
||||
|
||||
|
||||
/* echo $sql = 'SELECT vp.productoId, p.imagen, p.modelo, p.codigoBarra, p.precioVentaIva AS precioVenta,
|
||||
p.costo, p.proveedorId, p.prodCatId, p.prodSubcatId, SUM(vp.cantidad) AS vendidos
|
||||
FROM ventaProducto AS vp, venta AS v, producto p
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND vp.productoId = p.productoId
|
||||
AND status <> "Cancelado"
|
||||
AND v.fecha >= "'.date('Y-m-d',strtotime($fechaI)).' 00:00:00"
|
||||
AND v.fecha <= "'.date('Y-m-d',strtotime($fechaF)).' 23:59:59"
|
||||
AND v.sucursalId = "'.$sucursalId.'"
|
||||
'.$sqlFilter.'
|
||||
GROUP BY vp.productoId';*/
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$resProds = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
//echo count($resProds);
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
|
||||
$totalDisp = 0;
|
||||
$totalProds = 0;
|
||||
$totalImporte = 0;
|
||||
$totalCedis = 0;
|
||||
$totalPorLlegar = 0;
|
||||
$productos = array();
|
||||
foreach($resProds as $prod){
|
||||
$productoId = $prod['productoId'];
|
||||
|
||||
$reportes->setProductoId($productoId);
|
||||
$vendidos = $prod['vendidos'];
|
||||
$devueltos = $reportes->GetTotalProdDevBySuc();
|
||||
|
||||
$totalVendidos = $vendidos - $devueltos;
|
||||
$prod['vendidos'] = $totalVendidos;
|
||||
|
||||
$importe = $prod['vendidos'] * $prod['precioVenta'];
|
||||
$prod['total'] = $importe;
|
||||
//if($prod['vendidos'] == 0)
|
||||
// continue;
|
||||
|
||||
$proveedor->setProveedorId($prod['proveedorId']);
|
||||
$prod['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$prodCat->setProdCatId($prod['prodCatId']);
|
||||
$prod['depto'] = utf8_encode($prodCat->GetNameById());
|
||||
|
||||
$prodSubcat->setProdSubcatId($prod['prodSubcatId']);
|
||||
$prod['linea'] = utf8_encode($prodSubcat->GetNameById());
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
$prod['disponible'] = $disponible;
|
||||
|
||||
$reportes->setProductoId($productoId);
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$prod['cedis'] = $reportes->GetCantProdCedisBySuc();
|
||||
$prod['porLlegar'] = $reportes->GetCantProdNoCedisBySuc();
|
||||
|
||||
$totalDisp += $disponible;
|
||||
$totalProds += $totalVendidos;
|
||||
$totalImporte += $importe;
|
||||
$totalCedis += $prod['cedis'];
|
||||
$totalPorLlegar += $prod['porLlegar'];
|
||||
|
||||
$productos[] = $prod;
|
||||
|
||||
//Guardamos los Datos Globales
|
||||
if(array_key_exists($productoId, $prodGlobal)){
|
||||
$prod2 = $prodGlobal[$productoId];
|
||||
$prod2['disponible'] += $prod['disponible'];
|
||||
$prod2['porLlegar'] += $prod['porLlegar'];
|
||||
$prod2['cedis'] += $prod['cedis'];
|
||||
$prod2['vendidos'] += $prod['vendidos'];
|
||||
$prod2['total'] += $prod['total'];
|
||||
}else
|
||||
$prod2 = $prod;
|
||||
|
||||
$global['disponible'] += $prod['disponible'];
|
||||
$global['porLlegar'] += $prod['porLlegar'];
|
||||
$global['cedis'] += $prod['cedis'];
|
||||
$global['vendidos'] += $prod['vendidos'];
|
||||
$global['total'] += $prod['total'];
|
||||
|
||||
$prodGlobal[$productoId] = $prod2;
|
||||
|
||||
}//foreach
|
||||
$res['productos'] = $productos;
|
||||
|
||||
$res['disponible'] = $totalDisp;
|
||||
$res['vendidos'] = $totalProds;
|
||||
$res['importe'] = $totalImporte;
|
||||
$res['cedis'] = $totalCedis;
|
||||
$res['porLlegar'] = $totalPorLlegar;
|
||||
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$global['productos'] = $reportes->orderMultiDimensionalArray($prodGlobal,'vendidos',$mayormenor);
|
||||
|
||||
$smarty->assign("fi",$fechaI);
|
||||
$smarty->assign("ff",$fechaF);
|
||||
$smarty->assign("orden",$orden);
|
||||
$smarty->assign("type",$Usr);
|
||||
|
||||
$smarty->assign('global',$global);
|
||||
$smarty->assign('totDispGral',$totDispGral);
|
||||
$smarty->assign('totProdsGral',$totProdsGral);
|
||||
$smarty->assign('totImpGral',$totImpGral);
|
||||
$smarty->assign('sucursales',$sucursales);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-proMasVend2.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
case 'loadProdSubcats':
|
||||
|
||||
$prodSubcat->setProdCatId($_POST['prodCatId']);
|
||||
$subcategorias = $prodSubcat->EnumerateAll();
|
||||
$subcategorias = $util->EncodeResult($subcategorias);
|
||||
|
||||
$smarty->assign('subcategorias',$subcategorias);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/enumProdSubcat3.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
76
ajax/reportes-prods-transito.php
Executable file
76
ajax/reportes-prods-transito.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case 'prodsTransito':
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$sucursalId = $_POST['idSucursal'];
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$resSucursales = $reportes->EnumSucursales();
|
||||
|
||||
$cantGral;
|
||||
$totalGral;
|
||||
foreach($resSucursales as $res){
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$sql = 'SELECT p.codigoBarra, p.modelo, p.costo, p.precioVentaIva AS precioVenta,
|
||||
SUM(pd.cantidad) AS cantidad, (SUM(pd.cantidad) * p.precioVentaIva) AS total
|
||||
FROM envio e, envioPedido ep, pedidoDistribucion pd, producto AS p
|
||||
WHERE e.envioId = ep.envioId
|
||||
AND p.productoId = pd.productoId
|
||||
AND ep.pedidoId = pd.pedidoId
|
||||
AND e.status = "Pendiente"
|
||||
AND e.sucursalId = "'.$sucursalId.'"
|
||||
AND pd.sucursalId = "'.$sucursalId.'"
|
||||
AND pd.cantidad > 0
|
||||
GROUP BY pd.productoId';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$res['productos'] = $util->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$sql = 'SELECT SUM(pd.cantidad) AS cantidad, SUM(pd.cantidad * p.precioVentaIva) AS total
|
||||
FROM envio e, envioPedido ep, pedidoDistribucion pd, producto AS p
|
||||
WHERE e.envioId = ep.envioId
|
||||
AND p.productoId = pd.productoId
|
||||
AND ep.pedidoId = pd.pedidoId
|
||||
AND e.status = "Pendiente"
|
||||
AND e.sucursalId = "'.$sucursalId.'"
|
||||
AND pd.sucursalId = "'.$sucursalId.'"
|
||||
AND pd.cantidad > 0';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$res['cantidad'] = $row['cantidad'];
|
||||
$res['total'] = $row['total'];
|
||||
|
||||
$cantGral += $res['cantidad'];
|
||||
$totalGral += $res['total'];
|
||||
|
||||
if(count($res['productos']) > 0)
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$smarty->assign('cantGral',$cantGral);
|
||||
$smarty->assign('totalGral',$totalGral);
|
||||
$smarty->assign('sucursales',$sucursales);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-prods-transito.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
97
ajax/reportes-tickets.php
Executable file
97
ajax/reportes-tickets.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"]){
|
||||
|
||||
case "search":
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$codigoBarra = $_POST['codigoBarra2'];
|
||||
|
||||
$sql = 'SELECT prod.productoId, prod.codigoBarra, prod.modelo, prov.nombre AS proveedor
|
||||
FROM producto prod, proveedor prov
|
||||
WHERE prod.proveedorId = prov.proveedorId
|
||||
AND prod.codigoBarra = "'.$codigoBarra.'"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$info = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$productoId = $info['productoId'];
|
||||
|
||||
//Total de Ventas
|
||||
|
||||
$sql = 'SELECT SUM(vp.cantidad)
|
||||
FROM venta AS v, ventaProducto AS vp
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
AND vp.productoId = "'.$productoId.'"';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$info['totalVtas'] = $util->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
//Sucursal con mayor venta
|
||||
|
||||
$sql = 'SELECT SUM( vp.cantidad ) AS totalVentas, s.nombre AS sucursal
|
||||
FROM venta AS v, ventaProducto AS vp, sucursal AS s
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND v.sucursalId = s.sucursalId
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
AND vp.productoId = "'.$productoId.'"
|
||||
GROUP BY v.sucursalId
|
||||
ORDER BY `totalVentas` DESC
|
||||
LIMIT 1';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$info['sucMasVtas'] = urldecode($row['sucursal']).'<br>'.$row['totalVentas'].' Vtas';
|
||||
|
||||
//Sucursal con menos venta
|
||||
|
||||
$sql = 'SELECT SUM( vp.cantidad ) AS totalVentas, s.nombre AS sucursal
|
||||
FROM venta AS v, ventaProducto AS vp, sucursal AS s
|
||||
WHERE v.ventaId = vp.ventaId
|
||||
AND v.sucursalId = s.sucursalId
|
||||
AND ((v.status = "Cancelado" AND v.cancelDev = "1") OR v.status <> "Cancelado")
|
||||
AND v.status <> "Descuento"
|
||||
AND vp.productoId = "'.$productoId.'"
|
||||
GROUP BY v.sucursalId
|
||||
ORDER BY `totalVentas` ASC
|
||||
LIMIT 1';
|
||||
$util->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$row = $util->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
$info['sucMenosVtas'] = urldecode($row['sucursal']).'<br>'.$row['totalVentas'].' Vtas';
|
||||
|
||||
$reportes->setProductoId($productoId);
|
||||
$fecha = $reportes->GetUltCompByProd();
|
||||
|
||||
if($fecha)
|
||||
$info['fechaIngreso'] = date('d-m-Y H:i:s',strtotime($fecha));
|
||||
else
|
||||
$info['fechaIngreso'] = '---';
|
||||
|
||||
$reportes->setProductoId($productoId);
|
||||
$info['disponibles'] = $reportes->GetTotalProdDispGral();
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-tickets.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
1711
ajax/reportes-ventas.php
Executable file
1711
ajax/reportes-ventas.php
Executable file
File diff suppressed because it is too large
Load Diff
90
ajax/reportes/tipoGral.php
Executable file
90
ajax/reportes/tipoGral.php
Executable file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
$fechaIni = $_POST['fechaI'];
|
||||
$fechaFin = $_POST['fechaF'];
|
||||
|
||||
$fechaIni = $util->FormatDateMySql($fechaIni);
|
||||
$fechaFin = $util->FormatDateMySql($fechaFin);
|
||||
|
||||
$idSucursal = $_POST['idSucursal'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
|
||||
$start = microtime(true);
|
||||
$reportes->setIdSuc($idSucursal);
|
||||
$resSuc = $reportes->EnumSucursales($Usr['type'],$Usr['usuarioId']);
|
||||
|
||||
$totales = array();
|
||||
$sucursales = array();
|
||||
foreach($resSuc as $res){
|
||||
|
||||
$sucursalId = $res['sucursalId'];
|
||||
|
||||
$reportes->setIdSuc($sucursalId);
|
||||
$reportes->setFechaI($fechaIni);
|
||||
$reportes->setFechaF($fechaFin);
|
||||
|
||||
//Get total venta
|
||||
$ventas = $reportes->TotalVentasBySucReporte();
|
||||
$totalVenta = $ventas["totalVenta"];
|
||||
$noVentas = $ventas["ventas"];
|
||||
|
||||
$totalCostoVtas = $reportes->GetTotalSumProductosReporte();
|
||||
|
||||
$totalDev = $reportes->TotalDevolucionesBySucReporte();
|
||||
$totalCostoDev = $reportes->GetTotalCostoProductosReporte();
|
||||
|
||||
$totalVenta -= $totalDev;
|
||||
$totalCosto = $totalCostoVtas - $totalCostoDev;
|
||||
$utilidad = $totalVenta - $totalCosto;
|
||||
|
||||
$res['totalVenta'] = $totalVenta;
|
||||
$res['totalDev'] = $totalDev;
|
||||
$res['totalCosto'] = $totalCosto;
|
||||
$res['totalUtilidad'] = $utilidad;
|
||||
$res['totalNoVtas'] = $noVentas;
|
||||
|
||||
$totales['totalVenta'] += $totalVenta;
|
||||
$totales['totalDev'] += $totalDev;
|
||||
$totales['totalCosto'] += $totalCosto;
|
||||
$totales['totalUtilidad'] += $utilidad;
|
||||
$totales['totalNoVtas'] += $noVentas;
|
||||
|
||||
//Obtenemos las comisiones
|
||||
|
||||
$infG = $comision->getInfoGerente();
|
||||
$infSubG = $comision->getInfoSubgerente();
|
||||
|
||||
if($totalVenta <= $infG['rango'])
|
||||
$res['comisionGte'] = ($totalVenta * $infG['comisionBajo']) / 100;
|
||||
elseif($totalVenta > $infG['rango'])
|
||||
$res['comisionGte'] = ($totalVenta * $infG['comisionAlto']) / 100;
|
||||
|
||||
if($totalVenta <= $infSubG['rango'])
|
||||
$res['comisionSubGte'] = ($totalVenta * $infSubG['comisionBajo']) / 100;
|
||||
elseif($totalVenta > $infSubG['rango'])
|
||||
$res['comisionSubGte'] = ($totalVenta * $infSubG['comisionAlto']) / 100;
|
||||
|
||||
$sucursal->setSucursalId($sucursalId);
|
||||
$gerente = $sucursal->getGerente();
|
||||
$subGerente = $sucursal->getSubGerente();
|
||||
|
||||
$res['nomGte'] = $gerente['nombre']." ".$gerente['apellidos'];
|
||||
$res['nomSubGte'] = $subGerente['nombre']." ".$subGerente['apellidos'];
|
||||
|
||||
$sucursales[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$smarty->assign('totales',$totales);
|
||||
$smarty->assign('idSucursal',$idSucursal);
|
||||
$smarty->assign('sucursales',$sucursales);
|
||||
$smarty->assign('fechaIni', $fechaIni);
|
||||
$smarty->assign('fechaFin', $fechaFin);
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-venta.tpl');
|
||||
|
||||
$end = microtime(true);
|
||||
echo "Tiempo de Ejecución: ";
|
||||
echo $time = number_format(($end - $start), 2);
|
||||
?>
|
||||
174
ajax/sucursales.php
Executable file
174
ajax/sucursales.php
Executable file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "addSucursal":
|
||||
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-sucursal-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveSucursal":
|
||||
|
||||
$values = explode('&', $_POST['form']);
|
||||
|
||||
foreach($values as $key => $val){
|
||||
$values[$key] = explode('=', $values[$key]);
|
||||
}
|
||||
|
||||
$sucursal->setRfcId($_POST["rfcId"]);
|
||||
$sucursal->setNombre($values[0][1]);
|
||||
$sucursal->setNoSuc($values[1][1]);
|
||||
$sucursal->setCalle($values[2][1]);
|
||||
$sucursal->setNoExt($values[3][1]);
|
||||
$sucursal->setNoInt($values[4][1]);
|
||||
$sucursal->setReferencia($values[5][1]);
|
||||
$sucursal->setColonia($values[6][1]);
|
||||
$sucursal->setLocalidad($values[7][1]);
|
||||
$sucursal->setMunicipio($values[8][1]);
|
||||
$sucursal->setCiudad($values[9][1]);
|
||||
$sucursal->setCodigoPostal($values[10][1]);
|
||||
$sucursal->setEstado($values[11][1]);
|
||||
$sucursal->setPais($values[12][1]);
|
||||
$sucursal->setTelefono($values[13][1]);
|
||||
$sucursal->setMapa($values[14][1]);
|
||||
$sucursal->setArrendatario($values[15][1]);
|
||||
$sucursal->setMontoRenta($values[16][1]);
|
||||
$sucursal->setFechaVenc($values[17][1]);
|
||||
$sucursal->setIva($values[18][1]);
|
||||
|
||||
$sucursalId = $sucursal->Save();
|
||||
|
||||
if(!$sucursalId)
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editSucursal":
|
||||
|
||||
$sucursal->setSucursalId($_POST['id']);
|
||||
$info = $sucursal->Info();
|
||||
$info = $util->DecodeUrlRow($info);
|
||||
|
||||
$smarty->assign("post", $info);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-sucursal-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveEditSucursal":
|
||||
|
||||
$values = explode('&', $_POST['form']);
|
||||
|
||||
foreach($values as $key => $val){
|
||||
$values[$key] = explode('=', $values[$key]);
|
||||
}
|
||||
|
||||
$sucursal->setSucursalId($_POST['sucursalId']);
|
||||
$sucursal->setNombre($values[1][1]);
|
||||
$sucursal->setNoSuc($values[2][1]);
|
||||
$sucursal->setCalle($values[3][1]);
|
||||
$sucursal->setNoExt($values[4][1]);
|
||||
$sucursal->setNoInt($values[5][1]);
|
||||
$sucursal->setReferencia($values[6][1]);
|
||||
$sucursal->setColonia($values[7][1]);
|
||||
$sucursal->setLocalidad($values[8][1]);
|
||||
$sucursal->setMunicipio($values[9][1]);
|
||||
$sucursal->setCiudad($values[10][1]);
|
||||
$sucursal->setCodigoPostal($values[11][1]);
|
||||
$sucursal->setEstado($values[12][1]);
|
||||
$sucursal->setPais($values[13][1]);
|
||||
$sucursal->setTelefono($values[14][1]);
|
||||
$sucursal->setMapa($values[15][1]);
|
||||
$sucursal->setArrendatario($values[16][1]);
|
||||
$sucursal->setMontoRenta($values[17][1]);
|
||||
$sucursal->setFechaVenc($values[18][1]);
|
||||
$sucursal->setIva($values[19][1]);
|
||||
|
||||
if(!$sucursal->Update())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo "[#]";
|
||||
$info = $sucursal->Info();
|
||||
echo $info["rfcId"];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "viewSucursal":
|
||||
|
||||
$sucursal->setSucursalId($_POST['id']);
|
||||
$info = $sucursal->Info();
|
||||
$info = $util->DecodeUrlRow($info);
|
||||
|
||||
$smarty->assign("post", $info);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/detalles-sucursal-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "deleteSucursal":
|
||||
|
||||
$sucursal->setSucursalId($_POST['sucursalId']);
|
||||
$info = $sucursal->Info();
|
||||
|
||||
if($sucursal->Delete())
|
||||
{
|
||||
echo "Ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
echo $info["rfcId"];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'listSucursales':
|
||||
|
||||
$sucursal->setRfcId($_POST['rfc']);
|
||||
$result = $sucursal->GetSucursalesByRfc();
|
||||
$result2 = $util->EncodeResult($result);
|
||||
$sucursales = $util->DecodeUrlResult($result2);
|
||||
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->assign("sucursales", $sucursales);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/sucursales.tpl');
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
case "changeStatus":
|
||||
|
||||
$sucursal->setSucursalId($_POST['sucursalId']);
|
||||
$sucursal->setEmpresaId($_SESSION["empresaId"], 1);
|
||||
$sucursalInfo = $sucursal->SucursalInfo();
|
||||
|
||||
if($sucursal->ChangeStatus())
|
||||
{
|
||||
echo "Ok[#]";
|
||||
echo $sucursalInfo["rfcId"];
|
||||
}
|
||||
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
?>
|
||||
181
ajax/suggest_gral.php
Executable file
181
ajax/suggest_gral.php
Executable file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'proveedor':
|
||||
|
||||
$proveedor->setNombre($_POST['nombre']);
|
||||
$proveedores = $proveedor->Suggest();
|
||||
|
||||
$proveedores = $util->EncodeResult($proveedores);
|
||||
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/suggest-proveedor.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'producto':
|
||||
|
||||
$producto->setProveedorId($_POST['proveedorId']);
|
||||
$producto->setModelo($_POST['nombre']);
|
||||
$producto->setProdCatId($_POST['prodCatId']);
|
||||
$producto->setProdSubcatId($_POST['prodSubcatId']);
|
||||
$productos = $producto->Suggest();
|
||||
|
||||
$productos = $util->EncodeResult($productos);
|
||||
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/suggest-producto.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'cliente':
|
||||
|
||||
$clientes = $cliente->Suggest(trim($_POST['nombre']));
|
||||
$clientes = $util->EncodeResult($clientes);
|
||||
|
||||
$smarty->assign('clientes', $clientes);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/suggest-cliente.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'prodFact':
|
||||
|
||||
$noIdent = strtolower(trim($_POST['noIdent']));
|
||||
$products = $producto->SuggestVta();
|
||||
$resProds = $util->EncodeResult($products);
|
||||
|
||||
if($noIdent){
|
||||
|
||||
$limite = 20;
|
||||
$productos = array();
|
||||
foreach($resProds as $res){
|
||||
|
||||
$atribVal->setAtribValId($res['tallaId']);
|
||||
$res['talla'] = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($res['colorId']);
|
||||
$res['color'] = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$descripcion = $res['modelo'];
|
||||
$descripcion2 = $res['codigoBarra'].' '.$res['modelo'];
|
||||
|
||||
$res['descripcion'] = $descripcion;
|
||||
|
||||
if (strpos(strtolower($descripcion2), $noIdent) !== false)
|
||||
{
|
||||
$productos[] = $res;
|
||||
}
|
||||
|
||||
if(count($productos) == $limite)
|
||||
break;
|
||||
|
||||
}//foreach
|
||||
|
||||
}//if
|
||||
|
||||
$smarty->assign('productos', $productos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/suggest-producto-fact.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'prodByCode':
|
||||
|
||||
$codigoBarra = $_POST['codigoBarra'];
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$producto->setProveedorId($proveedorId);
|
||||
$productoId = $producto->GetProductIdByCodigo2();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$info = $producto->Info();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$atributos = $producto->GetAtributosAll();
|
||||
|
||||
$modelo = $atributos.'<br>'.$info['modelo'];
|
||||
|
||||
if($productoId != "" && $productoId != NULL)
|
||||
{
|
||||
echo 'ok[#]';
|
||||
echo utf8_encode($modelo);
|
||||
|
||||
echo '[#]';
|
||||
echo $productoId;
|
||||
|
||||
echo '[#]';
|
||||
echo $info['prodCatId'];
|
||||
|
||||
echo '[#]';
|
||||
echo $info['prodSubcatId'];
|
||||
}else
|
||||
{
|
||||
$util->setError(40001,'error');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'prodByCode2':
|
||||
|
||||
$codigoBarra = $_POST['codigoBarra'];
|
||||
$sucursalId = $_POST['sucursalId'];
|
||||
|
||||
if($sucursalId == ''){
|
||||
$util->setError(30015,'error','');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$producto->setCodigoBarra($codigoBarra);
|
||||
$productoId = $producto->GetProductIdByCodigo2();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$info = $producto->Info();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$atributos = $producto->GetAtributosAll();
|
||||
|
||||
$modelo = $atributos.'<br>'.$info['modelo'];
|
||||
|
||||
$proveedor->setProveedorId($info['proveedorId']);
|
||||
$nomProv = $proveedor->GetNameById();
|
||||
|
||||
$inventario->setProductoId($productoId);
|
||||
$inventario->setSucursalId($sucursalId);
|
||||
$disponible = $inventario->GetDispByProd();
|
||||
|
||||
if($productoId != "" && $productoId != NULL)
|
||||
{
|
||||
echo 'ok[#]';
|
||||
echo utf8_encode($modelo);
|
||||
|
||||
echo '[#]';
|
||||
echo $productoId;
|
||||
|
||||
echo '[#]';
|
||||
echo $nomProv;
|
||||
|
||||
echo '[#]';
|
||||
echo $disponible;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
111
ajax/suggest_x.php
Executable file
111
ajax/suggest_x.php
Executable file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "producto":
|
||||
|
||||
$result = $producto->Suggest($_POST["value"]);
|
||||
if(!$result)
|
||||
{
|
||||
echo '<div style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#666; padding:3px; width:400px" class="closeSuggestProductoDiv">No hay productos</div>';
|
||||
}
|
||||
|
||||
foreach($result as $producto)
|
||||
{
|
||||
?>
|
||||
|
||||
<div class="suggestProductoDiv" style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#333; padding:3px; width:530px;" id="<?php echo $producto["noIdentificacion"] ?>" >
|
||||
<div class="suggestProductoDiv" id="<?php echo $producto["noIdentificacion"] ?>" style="float:left;width:150px; cursor:pointer"><?php echo $producto["noIdentificacion"] ?></div>
|
||||
<div class="suggestProductoDiv" id="<?php echo $producto["noIdentificacion"] ?>" style="float:left;width:300px; cursor:pointer"><?php echo urldecode($producto["descripcion"]) ?></div>
|
||||
<div class="closeSuggestProductoDiv" style="float:left;width:20px; cursor:pointer">X</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "proveedor":
|
||||
|
||||
$result = $proveedor->Suggest($_POST["value"]);
|
||||
if(!$result)
|
||||
{
|
||||
echo '<div style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#666; padding:3px; width:400px" class="closeSuggestProductoDiv">No hay proveedores.</div>';
|
||||
}
|
||||
|
||||
foreach($result as $res)
|
||||
{
|
||||
?>
|
||||
|
||||
<div class="suggestProveedorDiv" style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#333; padding:3px; width:530px;" id="<?php echo $res["proveedorId"] ?>" >
|
||||
<div class="suggestProveedorDiv" id="<?php echo $res["proveedorId"] ?>" style="float:left;width:150px; cursor:pointer"><?php echo $res["rfc"] ?></div>
|
||||
<div class="suggestProveedorDiv" id="<?php echo $res["proveedorId"] ?>" style="float:left;width:300px; cursor:pointer"><?php echo urldecode($res["nombre"]) ?></div>
|
||||
<div class="closeSuggestSupplierDiv" style="float:left;width:20px; cursor:pointer">X</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "cliente":
|
||||
|
||||
$result = $cliente->Suggest($_POST["value"]);
|
||||
if(!$result)
|
||||
{
|
||||
echo '<div style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#666; padding:3px; width:400px" class="closeSuggestProductoDiv">No hay clientes.</div>';
|
||||
}
|
||||
|
||||
foreach($result as $res)
|
||||
{
|
||||
?>
|
||||
|
||||
<div class="suggestClienteDiv" style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#333; padding:3px; width:530px;" id="<?php echo $res["userId"] ?>" >
|
||||
<div class="suggestClienteDiv" id="<?php echo $res["userId"] ?>" style="float:left;width:150px; cursor:pointer"><?php echo $res["rfc"] ?></div>
|
||||
<div class="suggestClienteDiv" id="<?php echo $res["userId"] ?>" style="float:left;width:300px; cursor:pointer"><?php echo urldecode($res["nombre"]) ?></div>
|
||||
<div class="closeSuggestClienteDiv" style="float:left;width:20px; cursor:pointer">X</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "impuesto":
|
||||
|
||||
$result = $impuesto->Suggest($_POST["value"]);
|
||||
|
||||
if(!$result)
|
||||
{
|
||||
?>
|
||||
<div style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#666; padding:3px; width:400px" class="closeSuggestImpuestoDiv">No hay impuestos
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
foreach($result as $impuesto)
|
||||
{
|
||||
?>
|
||||
|
||||
<div class="suggestImpuestoDiv" style="border:solid; border-width:1px; border-color:#000; background-color:#FFFFE6; color:#333; padding:3px; width:530px;" id="<?php echo $impuesto["impuestoId"] ?>" >
|
||||
<div class="suggestImpuestoDiv" id="<?php echo $impuesto["impuestoId"] ?>" style="float:left;width:150px; cursor:pointer"><?php echo $impuesto["impuestoId"] ?></div>
|
||||
<div class="suggestImpuestoDiv" id="<?php echo $impuesto["impuestoId"] ?>" style="float:left;width:300px; cursor:pointer"><?php echo urldecode($impuesto["nombre"]) ?></div>
|
||||
<div class="closeSuggestImpuestoDiv" style="float:left;width:20px; cursor:pointer">X</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
96
ajax/tallas.php
Executable file
96
ajax/tallas.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'addTalla':
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-talla-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddTalla':
|
||||
|
||||
$talla->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$talla->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$tallas = $talla->Enumerate();
|
||||
$tallas['items'] = $util->EncodeResult($tallas['items']);
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/tallas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'editTalla':
|
||||
|
||||
$talla->setTallaId($_POST['id']);
|
||||
$info = $talla->Info();
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/editar-talla-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveEditTalla':
|
||||
|
||||
$talla->setTallaId($_POST['tallaId']);
|
||||
$talla->setNombre($_POST['nombre']);
|
||||
|
||||
if(!$talla->Update())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$tallas = $talla->Enumerate();
|
||||
$tallas['items'] = $util->EncodeResult($tallas['items']);
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/tallas.tpl');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deleteTalla':
|
||||
|
||||
$talla->setTallaId($_POST['id']);
|
||||
|
||||
if($talla->Delete())
|
||||
{
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo '[#]';
|
||||
$tallas = $talla->Enumerate();
|
||||
$tallas['items'] = $util->EncodeResult($tallas['items']);
|
||||
|
||||
$smarty->assign('tallas', $tallas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/tallas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-09-26 13:06:55
|
||||
compiled from "/var/www/html/templates/forms/filtro-tempo.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:936133865425ab3f4690a4-35349858%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'02a0cf44febe9dba5e23f8b330712dc78deaa79f' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/forms/filtro-tempo.tpl',
|
||||
1 => 1410130451,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '936133865425ab3f4690a4-35349858',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<form name="formTempo" id="formTempo" method="post" action="export/exportarexcel.php">
|
||||
<input type="hidden" name="type" id="type" value="tipoTempo"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" style="border-top:1px solid #999999">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center" colspan="1" width="50%"><div align="center">Temporada</div></th>
|
||||
<th align="center" colspan="1" width="25%"><div align="center">Sucursal</div></th>
|
||||
<th align="center" colspan="1" width="25%"><div align="center">Año</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="text-align:center">
|
||||
<select name="temporada" id="temporada" class="largeInput">
|
||||
<option selected="selected" value=""> Todas</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('resTemp')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value['temporadaId'];?>
|
||||
"> <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div style="text-align:center">
|
||||
<?php if ($_smarty_tpl->getVariable('tipo')->value=="admin"){?>
|
||||
<select name="sucursal" id="sucursal" class="largeInput">
|
||||
<option selected="selected" value="">Todas</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('resSuc')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value['sucursalId'];?>
|
||||
"> <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
<?php }elseif($_smarty_tpl->getVariable('tipo')->value=="gerente"||$_smarty_tpl->getVariable('tipo')->value=="vendedor"){?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('resSuc')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<input type="text" disabled="disabled" style="text-align:center" class="smallInput" value="<?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
"/>
|
||||
<input type="hidden" name="sucursal" id="sucursal" value="<?php echo $_smarty_tpl->getVariable('item')->value['sucursalId'];?>
|
||||
"/>
|
||||
<?php }} ?>
|
||||
<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div style="text-align:center">
|
||||
<select name="anio" id="anio" class="largeInput">
|
||||
<option selected="selected" value="">Seleccione</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('anio')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value;?>
|
||||
"> <?php echo $_smarty_tpl->getVariable('item')->value;?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" colspan="7">
|
||||
<input type="button" name="btnReporteTempo" id="btnReporteTempo" value="Generar" class="btnSearch" onclick="ReporteTempo()"/>
|
||||
<div style="float:right; padding-right:50px"><a href="#" onclick="ExportTempo(); return false;"><img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/excel.png" title="Exportar Reporte"/></a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-09-07 17:58:55
|
||||
compiled from "/var/www/html/templates/boxes/status_open_on_popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1777606882540ce32fb42b11-88944863%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'03de3e33333b3080d535c9e34db108cd9ee7c79a' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/boxes/status_open_on_popup.tpl',
|
||||
1 => 1410130449,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1777606882540ce32fb42b11-88944863',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="centeredDivOnPopup" class="" style="margin:auto; position:fixed; top:50%; left:50%; margin-top:-150px;margin-left:-275px;z-index:3000; display:none">
|
||||
<div style="width:548px; border:solid; border-color:#999;border-width:1px; background-color:#ccc; padding-left:5px; padding-top:5px; padding-bottom:5px">
|
||||
<div style="width:500px; border:solid; border-color:#999;border-width:1px; background-color:#FFF; padding:20px">
|
||||
<div id="close_icon" onclick="ToogleStatusDivOnPopup()" style="position:absolute;top: 35px; left: 500px;cursor:pointer; z-index:5000"><a href="javascript:void(0)"><img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/close_icon.gif" height="32" width="32" border="0"/></a></div>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-05-25 15:18:07
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/facturacion-mensual.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:79755283053824fff468874-97908302%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'03f4379ecf6f19d25ec9bbbd42a3d0f787bf8296' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/facturacion-mensual.tpl',
|
||||
1 => 1384905888,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '79755283053824fff468874-97908302',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/facturacion-mensual-header.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
|
||||
<?php if (count($_smarty_tpl->getVariable('comprobantes')->value['items'])){?>
|
||||
<?php $_smarty_tpl->tpl_vars['fact'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('comprobantes')->value['items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['fact']->key => $_smarty_tpl->tpl_vars['fact']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['fact']->key;
|
||||
?>
|
||||
<?php if ($_smarty_tpl->getVariable('key')->value%2==0){?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/facturacion-mensual-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }else{ ?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/facturacion-mensual-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"On"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }?>
|
||||
<?php }} ?>
|
||||
<?php }else{ ?>
|
||||
<tr><td colspan="8" align="center">Ningún registro encontrado.</td>
|
||||
<?php }?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/pages_new.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('pages',$_smarty_tpl->getVariable('comprobantes')->value['pages']);$_template->assign('colspan',8); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-09-26 13:04:35
|
||||
compiled from "/var/www/html/templates/lists/envios.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:12932476015425aab3901374-75984446%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'041d117c7b3b90f4b7f54f701418d7d20fa5fe4a' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/lists/envios.tpl',
|
||||
1 => 1410130459,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '12932476015425aab3901374-75984446',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-header.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
|
||||
<?php if (count($_smarty_tpl->getVariable('envios')->value['items'])){?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('envios')->value['items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<?php if ($_smarty_tpl->getVariable('key')->value%2==0){?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }else{ ?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"On"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }?>
|
||||
<?php }} ?>
|
||||
<?php }else{ ?>
|
||||
<tr><td colspan="9" align="center">Ningún registro encontrado.</td>
|
||||
<?php }?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/pages_new.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('pages',$_smarty_tpl->getVariable('envios')->value['pages']);$_template->assign('colspan',9); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-04 13:31:08
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/enumProvPromo.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1397652755538f65ecb1e968-34049888%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'047f6d1f0d2c6a4b43f40905cfb3101926dca65d' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/enumProvPromo.tpl',
|
||||
1 => 1401906157,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1397652755538f65ecb1e968-34049888',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('proveedores')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<input type="checkbox" name="idProveedor[]" value="<?php echo $_smarty_tpl->getVariable('item')->value['proveedorId'];?>
|
||||
" <?php if ($_smarty_tpl->getVariable('item')->value['checked']){?>checked<?php }?>/><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
|
||||
<br />
|
||||
<?php }} ?>
|
||||
@@ -0,0 +1,274 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-04 13:35:47
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/detalles-promocion.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:2130424323538f6703448ce8-56941482%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'049eb01278a8b0c71c28bbf1a76cab0cf2f545cd' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/detalles-promocion.tpl',
|
||||
1 => 1401906251,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '2130424323538f6703448ce8-56941482',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="divForm">
|
||||
|
||||
<fieldset>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Nombre:</b></div>
|
||||
<div class="r">
|
||||
<div class="txtFrm" style="width:680px"><?php echo $_smarty_tpl->getVariable('info')->value['nombre'];?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<b>* Vigencia</b>
|
||||
<br />
|
||||
<div class="txtFrm" style="width:150px">
|
||||
<?php if ($_smarty_tpl->getVariable('info')->value['vigencia']=="Periodo"){?>Por Periodo<?php }else{ ?>Permanente<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<div id="txtFechaIni" <?php if ($_smarty_tpl->getVariable('info')->value['vigencia']!="Periodo"){?>style="display:none"<?php }?>>
|
||||
<b>* Fecha Inicial:</b>
|
||||
<br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['fechaIni'];?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<div id="txtFechaFin" <?php if ($_smarty_tpl->getVariable('info')->value['vigencia']!="Periodo"){?>style="display:none"<?php }?>>
|
||||
<b>* Fecha Final:</b>
|
||||
<br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['fechaFin'];?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="3">
|
||||
* Aplicar Promoción a TODOS los productos?
|
||||
<br />
|
||||
<div class="txtFrm" style="width:150px">
|
||||
<?php if ($_smarty_tpl->getVariable('info')->value['aplicaTodos']=="1"){?>Sí<?php }elseif($_smarty_tpl->getVariable('info')->value['aplicaTodos']=="0"){?>No<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Sucursal:</b></div>
|
||||
<div class="r listChksV">
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('sucursales')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
- <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="listProducts" <?php if ($_smarty_tpl->getVariable('info')->value['aplicaTodos']=="1"){?>style="display:none"<?php }?>>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Departamento:</b></div>
|
||||
<div class="r listChksV">
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('categorias')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
- <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Línea:</b></div>
|
||||
<div class="r listChksV">
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('subcategorias')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
- <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Proveedor:</b></div>
|
||||
<div class="r listChksV">
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('proveedores')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
- <?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l"><b>* Producto:</b></div>
|
||||
<div class="r listChksV">
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('productos')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
- <?php echo $_smarty_tpl->getVariable('item')->value['descripcion'];?>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
</div>
|
||||
<?php echo count($_smarty_tpl->getVariable('productos')->value);?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left"><b>* Tipo de Promoción:</b></td>
|
||||
<td align="left" colspan="2"><b>* Aplica en:</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" width="230">
|
||||
<div class="txtFrm" style="width:150px">
|
||||
<?php if ($_smarty_tpl->getVariable('info')->value['tipo']=="AxB"){?> A x B
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['tipo']=="TotalVentaB"){?> Total Venta x B
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['tipo']=="CompraX"){?> Compra $x
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['tipo']=="BuenFin"){?> Buen Fin
|
||||
<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left" colspan="2">
|
||||
<div class="txtFrm" style="width:440px">
|
||||
<?php if ($_smarty_tpl->getVariable('info')->value['aplica']=="XxY"){?> Compra X Prods. al Precio de Y por Producto
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="N1Desc"){?> Compra N Prods. y N+1 aplica un Descuento
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="CompraX"){?> Compra $x y Regala B
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="CompraXabonoM"){?> Compra $x y Abona % a Monedero
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="DescCuenta"){?> Descuento por toda la Cuenta
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="ArtConDesc"){?> Artículos después de $x con Descuento
|
||||
<?php }elseif($_smarty_tpl->getVariable('info')->value['aplica']=="3x2"){?> 3 x 2
|
||||
<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowXY" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="XxY"){?>style="display:none"<?php }?>>
|
||||
<td align="left"></td>
|
||||
<td align="left">
|
||||
<b>* Valor de X:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['valorX'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<b>* Valor Y:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['valorY'];?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowTipoDesc" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="N1Desc"&&$_smarty_tpl->getVariable('info')->value['aplica']!="DescCuenta"&&$_smarty_tpl->getVariable('info')->value['aplica']!="ArtConDesc"){?>style="display:none"<?php }?>>
|
||||
<td align="left">
|
||||
<b>* Tipo de Descuento:</b> <br />
|
||||
<div class="txtFrm" style="width:150px">
|
||||
<?php if ($_smarty_tpl->getVariable('info')->value['tipoDesc']=="Cantidad"){?>Cantidad Fija<?php }else{ ?>Porcentaje<?php }?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<b>* Valor del Descuento:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['valorDesc'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<div id="txtTotalCompra" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="DescCuenta"&&$_smarty_tpl->getVariable('info')->value['aplica']!="ArtConDesc"){?>style="display:none"<?php }?>>
|
||||
<b>* Total de la Compra:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['totalCompra'];?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="txtValorN" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="N1Desc"){?>style="display:none"<?php }?>>
|
||||
<b>* Valor N:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['valorN'];?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowTotalVentaB" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="CompraX"){?>style="display:none"<?php }?>>
|
||||
<td align="left">
|
||||
<b>* Total de la Compra:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['totalCompra'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
<b>* Cant. de Art. a Regalar:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['cantArtRegalo'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr id="rowProdVentaB" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="CompraX"){?>style="display:none"<?php }?>>
|
||||
<td align="left" colspan="3">
|
||||
<b>* Producto a Regalar:</b> <br />
|
||||
<div class="txtFrm" style="width:380px"><?php echo $_smarty_tpl->getVariable('info')->value['producto'];?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowTotalVentaM" <?php if ($_smarty_tpl->getVariable('info')->value['aplica']!="CompraXabonoM"){?>style="display:none"<?php }?>>
|
||||
<td align="left">
|
||||
* Total de la Compra: <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['totalCompra'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
* Porcentaje Abonar: <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['valorDesc'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
<b>* Status:</b> <br />
|
||||
<div class="txtFrm" style="width:150px"><?php echo $_smarty_tpl->getVariable('info')->value['status'];?>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
<hr />
|
||||
|
||||
* Campos requeridos
|
||||
<div class="formLine" style="text-align:center; padding-left:300px">
|
||||
<a class="button" id="btnClose"><span>Cerrar</span></a>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-25 08:00:35
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/pedidos-productos-dev.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:97751271053aac7f30ccd51-95038264%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'04d4645fa0ac11d7d21a295c9b5d04f16ca1579d' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/pedidos-productos-dev.tpl',
|
||||
1 => 1381517985,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '97751271053aac7f30ccd51-95038264',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php $_smarty_tpl->tpl_vars['it'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('products')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['it']->key => $_smarty_tpl->tpl_vars['it']->value){
|
||||
$_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['it']->key;
|
||||
?>
|
||||
<hr />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Departamento:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['departamento'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Línea:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['linea'];?>
|
||||
</div></td>
|
||||
<td width="30" align="center">
|
||||
<a href="javascript:void(0)" onclick="DeleteProducto(<?php echo $_smarty_tpl->getVariable('k')->value;?>
|
||||
)" title="Eliminar">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/delete.png" border="0" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Modelo:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['modelo'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Descripción:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['atributos'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Código de Barra:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['codigoBarra'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Disponible:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['disponible'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Sucursal:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['sucursal'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Cantidad a Dev:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['cantidad'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" align="center"> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<?php }} else { ?>
|
||||
<hr />
|
||||
Ningún producto encontrado.
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-09-11 11:29:13
|
||||
compiled from "/var/www/html/templates/items/reportes-proMasVend-base.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:7461914375411cdd9e46302-62005122%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'04e42e51d920368a743ed56efe978e9b619c3459' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/items/reportes-proMasVend-base.tpl',
|
||||
1 => 1410130456,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '7461914375411cdd9e46302-62005122',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('sucursales')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
|
||||
<thead >
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th id="alinear" colspan="1"><b><?php echo urldecode((utf8_decode($_smarty_tpl->getVariable('item')->value['nombre'])));?>
|
||||
</b></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th ><div style="float:right"><a href="javascript:void(0)" id="showHide<?php echo $_smarty_tpl->getVariable('item')->value['sucursalId'];?>
|
||||
" onclick="ShowDesc(<?php echo $_smarty_tpl->getVariable('item')->value['sucursalId'];?>
|
||||
)">[+]</a></div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="totales<?php echo $_smarty_tpl->getVariable('item')->value['sucursalId'];?>
|
||||
" style="display:none">
|
||||
<tr style="background:#E0E5E7;text-align:center">
|
||||
<th id="alinear"><b>Código de Barras</b></th>
|
||||
<th id="alinear"><b>Producto</b></th>
|
||||
<th id="alinear"><b>Inv. Actual</b></th>
|
||||
<th id="alinear"><b>Número de productos vendidos</b></th>
|
||||
<th id="alinear"><b>Costo</b></th>
|
||||
<th id="alinear"><b>Precio Venta</b></th>
|
||||
<th id="alinear"><b>Importe Total</b></th>
|
||||
</tr>
|
||||
<?php $_smarty_tpl->tpl_vars['itP'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['k1'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('item')->value['productos']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['itP']->key => $_smarty_tpl->tpl_vars['itP']->value){
|
||||
$_smarty_tpl->tpl_vars['k1']->value = $_smarty_tpl->tpl_vars['itP']->key;
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-align:center;"><?php echo $_smarty_tpl->getVariable('itP')->value['codigoBarra'];?>
|
||||
</td>
|
||||
<td style="text-align:left;"><?php echo $_smarty_tpl->getVariable('itP')->value['modelo'];?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('itP')->value['disponible'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('itP')->value['vendidos'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('itP')->value['costo'],2,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('itP')->value['precioVenta'],2,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('itP')->value['total'],2,'.',',');?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }} ?>
|
||||
<tr>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"><b>TOTAL</b></td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('item')->value['disponible'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('item')->value['vendidos'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('item')->value['importe'],2,'.',',');?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<?php }} ?>
|
||||
|
||||
|
||||
<?php if ($_smarty_tpl->getVariable('Usr')->value['type']=="admin"||$_smarty_tpl->getVariable('Usr')->value['type']=="direccion"||$_smarty_tpl->getVariable('Usr')->value['type']=="almacen"||$_smarty_tpl->getVariable('Usr')->value['type']=="centralizador"){?>
|
||||
<thead >
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th id="alinear" colspan="1"><b><?php if ($_smarty_tpl->getVariable('orden')->value=="mayor"){?>Productos Más Vendidos<?php }else{ ?>Productos Menos Vendidos<?php }?></b></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th><div style="float:right"><a href="javascript:void(0)" id="showHide0" onclick="ShowDesc(0)">[+]</a></div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="totales0" style="display:none">
|
||||
<tr style="background:#E0E5E7;text-align:center">
|
||||
<th id="alinear"><b>Código de Barras</b></th>
|
||||
<th id="alinear"><b>Producto</b></th>
|
||||
<th id="alinear"><b>Inv. Actual</b></th>
|
||||
<th id="alinear"><b>Número de productos vendidos</b></th>
|
||||
<th id="alinear"><b>Costo</b></th>
|
||||
<th id="alinear"><b>Precio Venta</b></th>
|
||||
<th id="alinear"><b>Importe Total</b></th>
|
||||
</tr>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('prodsGral')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-align:center;"><?php echo $_smarty_tpl->getVariable('item')->value['codigoBarra'];?>
|
||||
</td>
|
||||
<td style="text-align:left;"><?php echo $_smarty_tpl->getVariable('item')->value['modelo'];?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('item')->value['disponible'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('item')->value['vendidos'],0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('item')->value['costo'],2,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('item')->value['precioVenta'],2,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('item')->value['total'],2,'.',',');?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }} ?>
|
||||
<tr>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"><b>TOTAL</b></td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('totDispGral')->value,0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo number_format($_smarty_tpl->getVariable('totProdsGral')->value,0,'.',',');?>
|
||||
</td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;">$<?php echo number_format($_smarty_tpl->getVariable('totImpGral')->value,2,'.',',');?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php }?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 20:11:39
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/envios-productos-recibidos.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:155235921953619f4b084379-49353993%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'05153a49f61b187e3d236fa9f81d77acf267b09e' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/envios-productos-recibidos.tpl',
|
||||
1 => 1391103506,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '155235921953619f4b084379-49353993',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-productos-recibidos-header.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
|
||||
<?php if (count($_smarty_tpl->getVariable('productos')->value['items'])){?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('productos')->value['items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<?php if ($_smarty_tpl->getVariable('key')->value%2==0){?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-productos-recibidos-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }else{ ?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/envios-productos-recibidos-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"On"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }?>
|
||||
<?php }} ?>
|
||||
<?php }else{ ?>
|
||||
<tr><td colspan="10" align="center">Ningún registro encontrado.</td>
|
||||
<?php }?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/pages_new.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('pages',$_smarty_tpl->getVariable('productos')->value['pages']);$_template->assign('colspan',10); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 09:54:47
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-devolucion-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:110585697653610eb7c24262-29040119%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'059db46763075f0805591abbd45da5ea4c5e48db' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-devolucion-popup.tpl',
|
||||
1 => 1375965202,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '110585697653610eb7c24262-29040119',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="divIframe" style="height:700px"></div>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-12 17:46:04
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/detalles-proveedor-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:525946378539a2dac681907-99431434%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'05a7fca205a0945c6d6c5c3c9bb13b4ef98a9d3a' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/detalles-proveedor-popup.tpl',
|
||||
1 => 1375965214,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '525946378539a2dac681907-99431434',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="popupheader" style="z-index:70">
|
||||
<div id="fviewmenu" style="z-index:70">
|
||||
<div id="fviewclose"><span style="color:#CCC" id="closePopUpDiv">Close<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/b_disn.png" border="0" alt="close" /></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ftitl">
|
||||
<div class="flabel">Detalles Proveedor</div>
|
||||
<div id="vtitl"><span title="Titulo">Detalles Proveedor</span></div>
|
||||
</div>
|
||||
<div id="draganddrop" style="position:absolute;top:45px;left:640px">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/draganddrop.png" border="0" alt="mueve" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/forms/detalles-proveedor.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-05-25 15:18:07
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/facturacion-mensual-header.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:24311562553824fff587061-61985102%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0637c5558b426ad4faec8507acc417c1649dce82' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/facturacion-mensual-header.tpl',
|
||||
1 => 1384905907,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '24311562553824fff587061-61985102',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="clear"></div>
|
||||
<!--THIS IS A WIDE PORTLET-->
|
||||
<div class="portlet">
|
||||
<div align="center">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/user.gif" width="16" height="16" /> Resumen de Comprobantes Emitidos
|
||||
</div>
|
||||
<div class="portlet-content nopadding">
|
||||
<form action="" method="post">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" summary="Employee Pay Sheet">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70" scope="col"><div align="center">RFC</div></th>
|
||||
<th width="" scope="col"><div align="center">Nombre</div></th>
|
||||
<th width="60" scope="col"><div align="center">Fecha</div></th>
|
||||
<th width="89" scope="col"><div align="center">Monto</div></th>
|
||||
<th width="60" scope="col"><div align="center">Folio</div></th>
|
||||
<?php if ($_smarty_tpl->getVariable('version')->value=="construc"||$_smarty_tpl->getVariable('version')->value=="v3"){?>
|
||||
<th width="120" scope="col"><div align="center">UUID</div></th>
|
||||
<?php }?>
|
||||
<th width="70" scope="col"><div align="center">Periodo</div></th>
|
||||
<th width="34" scope="col"><div align="center">Acciones</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 18:22:16
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/export-vista-previa.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1504171389536185a866c807-57997172%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'07155d6b181f7b6ebd65f60378d6804a9ec90e78' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/export-vista-previa.tpl',
|
||||
1 => 1375965226,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1504171389536185a866c807-57997172',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div>
|
||||
Vista previa disponible.
|
||||
<br /><br />
|
||||
<a href="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/util/download.php?path=<?php echo $_smarty_tpl->getVariable('comprobante')->value['path'];?>
|
||||
&secPath=temp&filename=vistaPrevia.pdf&contentType=text/pdf" target="_blank" title="Descargar Vista Previ">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/pdf_icon.png" height="100" width="100" border="0"/>
|
||||
</a>
|
||||
</div>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2016-05-03 14:57:54
|
||||
compiled from "/var/www/html/templates/items/usuarios-header.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:150116824572902c24f9803-42171337%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'07fcfd9716a3d57f77cbbca50b9d1ce20155dc05' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/items/usuarios-header.tpl',
|
||||
1 => 1410130456,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '150116824572902c24f9803-42171337',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="clear"></div>
|
||||
<!--THIS IS A WIDE PORTLET-->
|
||||
<div class="portlet">
|
||||
|
||||
<div class="portlet-content nopadding">
|
||||
<form action="" method="post">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" summary="Employee Pay Sheet">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="" scope="col">Nombre</th>
|
||||
<th width="180" scope="col"><div align="center">Email</div></th>
|
||||
<th width="150" scope="col"><div align="center">Tipo</div></th>
|
||||
<th width="170" scope="col"><div align="center">Sucursal</div></th>
|
||||
<th width="100" scope="col"><div align="center">Acciones</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-09-08 12:05:17
|
||||
compiled from "/var/www/html/templates/lists/pedidos-productos-dev.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1778210059540de1cdca0c65-36965405%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0829d067e16676a3d5cbab5bfaa85ef8030e5038' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/lists/pedidos-productos-dev.tpl',
|
||||
1 => 1410130460,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1778210059540de1cdca0c65-36965405',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php $_smarty_tpl->tpl_vars['it'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('products')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['it']->key => $_smarty_tpl->tpl_vars['it']->value){
|
||||
$_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['it']->key;
|
||||
?>
|
||||
<hr />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Departamento:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['departamento'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Línea:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['linea'];?>
|
||||
</div></td>
|
||||
<td width="30" align="center">
|
||||
<a href="javascript:void(0)" onclick="DeleteProducto(<?php echo $_smarty_tpl->getVariable('k')->value;?>
|
||||
)" title="Eliminar">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/delete.png" border="0" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Modelo:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['modelo'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Descripción:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['atributos'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Código de Barra:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['codigoBarra'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Disponible:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['disponible'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="120" align="left" height="40">Sucursal:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['sucursal'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
<td width="130" align="left">Cantidad a Dev:</td>
|
||||
<td align="left"><div class="txtFrm" style="width:270px"><?php echo $_smarty_tpl->getVariable('it')->value['cantidad'];?>
|
||||
</div></td>
|
||||
<td width="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" align="center"> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<?php }} else { ?>
|
||||
<hr />
|
||||
Ningún producto encontrado.
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-18 10:28:50
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/conceptos-facturacion.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:112157521553a1b0326d8a56-18473896%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'092ccd4633743b877193eb7ab6b3d9a3e1b545c6' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/conceptos-facturacion.tpl',
|
||||
1 => 1384905875,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '112157521553a1b0326d8a56-18473896',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" style="border-top:1px solid #CCCCCC">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="50" align="center"> </th>
|
||||
<th width="50" align="center"><div align="center">Cant.</div></th>
|
||||
<th width="100" align="center"><div align="center">Unid.</div></th>
|
||||
<th width="50" align="center"><div align="center">ID.</div></th>
|
||||
<th width="300" align="center"><div align="center">Descripción</div></th>
|
||||
<th width="100" align="center"><div align="center">V. Unitario</div></th>
|
||||
<th width="100" align="center"><div align="center">Importe</div></th>
|
||||
<th width="50" align="center"><div align="center">E. Iva</div></th>
|
||||
<th width="50" align="center"><div align="center">Acción</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $_smarty_tpl->tpl_vars['concepto'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('conceptos')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['concepto']->key => $_smarty_tpl->tpl_vars['concepto']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['concepto']->key;
|
||||
?>
|
||||
<tr id="conceptoDiv<?php echo $_smarty_tpl->getVariable('key')->value;?>
|
||||
">
|
||||
<td id="conceptoBaseUserId<?php echo $_smarty_tpl->getVariable('key')->value;?>
|
||||
" align="center" valign="top"><?php echo $_smarty_tpl->getVariable('key')->value;?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo number_format($_smarty_tpl->getVariable('concepto')->value['cantidad'],2,".",",");?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo $_smarty_tpl->getVariable('concepto')->value['unidad'];?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo $_smarty_tpl->getVariable('concepto')->value['noIdentificacion'];?>
|
||||
</td>
|
||||
<td style="font-family:'Courier New', Courier, monospace; text-align:justify" valign="top"><?php echo nl2br($_smarty_tpl->getVariable('concepto')->value['descripcion']);?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo number_format($_smarty_tpl->getVariable('concepto')->value['valorUnitario'],2,".",",");?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo number_format($_smarty_tpl->getVariable('concepto')->value['importe'],2,".",",");?>
|
||||
</td>
|
||||
<td align="center" valign="top"><?php echo $_smarty_tpl->getVariable('concepto')->value['excentoIva'];?>
|
||||
</td>
|
||||
<td align="center" valign="top">
|
||||
<a href="javascript:void(0)" onclick="BorrarConcepto(<?php echo $_smarty_tpl->getVariable('key')->value;?>
|
||||
)" title="Eliminar">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/action_delete.gif" border="0" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }} else { ?>
|
||||
<tr>
|
||||
<td colspan="9" align="center">Ningún concepto encontrado.</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 10:27:51
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-metodo-pago-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:103174602453611677457766-62745659%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'096aa982e346a2513aba04327c0921e5afe34c24' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-metodo-pago-popup.tpl',
|
||||
1 => 1375965204,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '103174602453611677457766-62745659',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="popupheader" style="z-index:70">
|
||||
<div id="fviewmenu" style="z-index:70">
|
||||
<div id="fviewclose"><span style="color:#CCC" id="closePopUpDiv">Close<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/b_disn.png" border="0" alt="close" /></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ftitl">
|
||||
<div class="flabel">Agregar Método de Pago</div>
|
||||
<div id="vtitl"><span title="Titulo">Agregar Método de Pago</span></div>
|
||||
</div>
|
||||
<div id="draganddrop" style="position:absolute;top:45px;left:640px">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/draganddrop.png" border="0" alt="mueve" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/forms/agregar-metodo-pago.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-04 13:33:28
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/excluir-promocion.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:729317341538f667861f0d8-80577666%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0a34406c18cba5f25f2583bf11ee511f35259490' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/excluir-promocion.tpl',
|
||||
1 => 1401906803,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '729317341538f667861f0d8-80577666',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="divForm">
|
||||
<form name="frmPromocion" id="frmPromocion" method="post" action="">
|
||||
<input type="hidden" name="type" id="type" value="saveExcluirPromocion" />
|
||||
<input type="hidden" name="promocionId" id="promocionId" value="<?php echo $_smarty_tpl->getVariable('info')->value['promocionId'];?>
|
||||
" />
|
||||
<fieldset>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">* Proveedor:</div>
|
||||
<div class="r">
|
||||
<select name="proveedorId" id="proveedorId" class="largeInput wide2">
|
||||
<option value="">Seleccione</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('proveedores')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value['proveedorId'];?>
|
||||
"><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">Departamento:</div>
|
||||
<div class="r">
|
||||
<select name="prodCatId" id="prodCatId" class="largeInput wide2" onchange="LoadSubcatsExc()">
|
||||
<option value="">Todos</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('categorias')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value['prodCatId'];?>
|
||||
"><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">Línea:</div>
|
||||
<div class="r" id="enumSubcats">
|
||||
<select name="prodSubcatId" id="prodSubcatId" class="largeInput wide2">
|
||||
<option value="">Todas</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div style="float:left">* Producto:</div>
|
||||
<div style="float:right; padding-right:20px">
|
||||
<input type="checkbox" name="checkProd" id="checkProd" value="1" onclick="CheckAllProd()" />Marcar Todos
|
||||
</div>
|
||||
<div class="r listChks" id="enumProds" style="clear:both">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/enumProdPromo.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="cantProds" style="float:left"></div>
|
||||
<div align="right">
|
||||
<input type="button" value="Actualizar Productos" style="padding:6px; margin-right:15px" onclick="LoadProdsExc()" />
|
||||
</div>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
<hr />
|
||||
* Campos requeridos
|
||||
|
||||
<div align="center" id="loader" style="display:none">
|
||||
Este proceso puede tardar unos minutos.
|
||||
<br />Por favor, espere.
|
||||
<br /><img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/loading.gif" />
|
||||
</div>
|
||||
|
||||
<div class="formLine" style="text-align:center; padding-left:310px">
|
||||
<a class="button" id="btnEdit"><span>Agregar</span></a>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<div align="center"><b>PRODUCTOS EXCLUIDOS</b></div>
|
||||
<br />
|
||||
<div id="tblProds" align="center">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/promociones-productos.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 08:32:25
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/aplicar-promo-venta-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:12444975585360fb69427739-10193678%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0b489822468666ca13af16c8622be5973f7b47cd' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/aplicar-promo-venta-popup.tpl',
|
||||
1 => 1375965211,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '12444975585360fb69427739-10193678',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php if ($_smarty_tpl->getVariable('promoId')->value){?>
|
||||
|
||||
<div align="center" class="txtH1">PROMOCION APLICADA</div>
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
<?php echo $_smarty_tpl->getVariable('nomPromo')->value;?>
|
||||
|
||||
<br /><br />
|
||||
<table width="50%" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<tr>
|
||||
<td align="center" height="50" width="50%">
|
||||
<input type="button" style="padding:10px; width:100px" value="Eliminar" onclick="EliminarPromo(<?php echo $_smarty_tpl->getVariable('promoId')->value;?>
|
||||
)" />
|
||||
</td>
|
||||
<td align="center" height="50" width="50%">
|
||||
<input type="button" style="padding:10px; width:100px" value="Cancelar" onclick="HideFviewCobro()" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php }else{ ?>
|
||||
|
||||
<div align="center" class="txtH1">APLICAR PROMOCION</div>
|
||||
|
||||
<?php if (count($_smarty_tpl->getVariable('promociones')->value)){?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<tr>
|
||||
<td align="center"><b>Seleccione la Promoción:</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<select name="promocionId" id="promocionId" class="largeInput">
|
||||
<option value="">Seleccione</option>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('promociones')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<option value="<?php echo $_smarty_tpl->getVariable('item')->value['promocionId'];?>
|
||||
"><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="50%" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<tr>
|
||||
<td align="center" height="50" width="50%">
|
||||
<input type="button" style="padding:10px; width:100px" value="Aplicar" onclick="AsignarPromo()" />
|
||||
</td>
|
||||
<td align="center" height="50" width="50%">
|
||||
<input type="button" style="padding:10px; width:100px" value="Cancelar" onclick="HideFviewCobro()" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }else{ ?>
|
||||
<div align="center">
|
||||
<br />
|
||||
Ninguna promocion encontrada.
|
||||
<br /><br />
|
||||
<input type="button" style="padding:10px; width:100px" value="Cancelar" onclick="HideFviewCobro()" />
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<?php }?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-29 22:57:29
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/analisis-sucursal.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1137908193536074a9b353a1-89202520%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0c0488c3e87d96665f6a17d2be7a1d4537bc3fbf' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/analisis-sucursal.tpl',
|
||||
1 => 1381165837,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1137908193536074a9b353a1-89202520',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="subTable">
|
||||
<?php $_smarty_tpl->tpl_vars['iS'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['kS'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('sucursales')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['iS']->key => $_smarty_tpl->tpl_vars['iS']->value){
|
||||
$_smarty_tpl->tpl_vars['kS']->value = $_smarty_tpl->tpl_vars['iS']->key;
|
||||
?>
|
||||
<tr>
|
||||
<td width="40" height="35"></td>
|
||||
<td align="center" width="40">
|
||||
<a href="javascript:void(0)" onclick="ShowProveedores(<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
)"><div id="iconSuc_<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
">[+]</div></a>
|
||||
</td>
|
||||
<td align="left"><?php echo $_smarty_tpl->getVariable('iS')->value['nombre'];?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="prov_<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
" style="display:none">
|
||||
<td colspan="3" align="left">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/analisis-proveedor.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php }} else { ?>
|
||||
<tr>
|
||||
<td align="center">Ningún registro encontrado.</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-11 14:23:29
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/editar-comision-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:20033802835398acb182d5a4-39379405%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0db41191c0891e1ea9719ffc4dde6a8c82edb0e4' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/editar-comision-popup.tpl',
|
||||
1 => 1375965218,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '20033802835398acb182d5a4-39379405',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="popupheader" style="z-index:70">
|
||||
<div id="fviewmenu" style="z-index:70">
|
||||
<div id="fviewclose"><span style="color:#CCC" id="closePopUpDiv">
|
||||
<a href="javascript:void(0)">Close<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/b_disn.png" border="0" alt="close" /></a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ftitl">
|
||||
<div class="flabel">Editar Politica de Comision</div>
|
||||
<div id="vtitl"><span title="Titulo">Editar Politica de Comision</span></div>
|
||||
</div>
|
||||
<div id="draganddrop" style="position:absolute;top:45px;left:640px">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/draganddrop.png" border="0" alt="mueve" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/forms/editar-comision.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-12-11 10:02:50
|
||||
compiled from "/var/www/html/templates/lists/analisis-sucursal.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:20892109195489c02a5d6170-84068245%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0df98406c6b3dfe01787fbec01cc4c2ebd78c449' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/lists/analisis-sucursal.tpl',
|
||||
1 => 1410130457,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '20892109195489c02a5d6170-84068245',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="subTable">
|
||||
<?php $_smarty_tpl->tpl_vars['iS'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['kS'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('sucursales')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['iS']->key => $_smarty_tpl->tpl_vars['iS']->value){
|
||||
$_smarty_tpl->tpl_vars['kS']->value = $_smarty_tpl->tpl_vars['iS']->key;
|
||||
?>
|
||||
<tr>
|
||||
<td width="40" height="35"></td>
|
||||
<td align="center" width="40">
|
||||
<a href="javascript:void(0)" onclick="ShowProveedores(<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
)"><div id="iconSuc_<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
">[+]</div></a>
|
||||
</td>
|
||||
<td align="left"><?php echo $_smarty_tpl->getVariable('iS')->value['nombre'];?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="prov_<?php echo $_smarty_tpl->getVariable('kS')->value;?>
|
||||
" style="display:none">
|
||||
<td colspan="3" align="left">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/analisis-proveedor.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php }} else { ?>
|
||||
<tr>
|
||||
<td align="center">Ningún registro encontrado.</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-18 10:28:51
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/total-desglosado.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:6466337453a1b0337b6891-17376715%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0e7661214b15bf2f07b814da0e0f8aa893f4bb0a' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/total-desglosado.tpl',
|
||||
1 => 1375965231,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '6466337453a1b0337b6891-17376715',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div style="width:750px;">
|
||||
|
||||
<?php if ($_smarty_tpl->getVariable('impuestos')->value){?>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Subtotal Original
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['subtotalOriginal'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<?php $_smarty_tpl->tpl_vars['impuesto'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('impuestos')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['impuesto']->key => $_smarty_tpl->tpl_vars['impuesto']->value){
|
||||
?>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
<?php if ($_smarty_tpl->getVariable('impuesto')->value['tipo']=="retencion"){?>
|
||||
Retención
|
||||
<?php }elseif($_smarty_tpl->getVariable('impuesto')->value['tipo']=="deduccion"){?>
|
||||
Deducción
|
||||
<?php }?>
|
||||
<?php echo $_smarty_tpl->getVariable('impuesto')->value['tasa'];?>
|
||||
% de <?php echo $_smarty_tpl->getVariable('impuesto')->value['impuesto'];?>
|
||||
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('impuesto')->value['importe'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<?php }} ?>
|
||||
<?php }?>
|
||||
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Subtotal
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['subtotal'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Descuento
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['descuento'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Después de Descuento
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['afterDescuento'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
IVA
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['iva'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Después de IVA
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['afterIva'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
IEPS
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['ieps'];?>
|
||||
|
||||
</div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Después de Impuestos
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['afterImpuestos'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Ret. IVA
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['retIva'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Ret. ISR
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['retIsr'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="float:left; width:350px ;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
Total
|
||||
</div>
|
||||
<div style="float:left; width:250px;border:solid; border-width:1px; border-color:#000; background-color:#FFC; padding:5px">
|
||||
$ <?php echo $_smarty_tpl->getVariable('totalDesglosado')->value['total'];?>
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 10:09:41
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-pago-popup.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:14212676345361123596dfc7-59884567%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'0f64aaefb227bd24b85a1c90529dcfaf9b6c7fa2' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/agregar-pago-popup.tpl',
|
||||
1 => 1379913041,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '14212676345361123596dfc7-59884567',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="popupheader" style="z-index:70">
|
||||
<div id="fviewmenu" style="z-index:70">
|
||||
<div id="fviewclose"><span style="color:#CCC" id="closePopUpDiv">
|
||||
<a href="javascript:void(0)">Close<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/b_disn.png" border="0" alt="close" /></a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ftitl">
|
||||
<div class="flabel">Agregar Pago :: Pedido No. <?php echo $_smarty_tpl->getVariable('info')->value['noPedido'];?>
|
||||
</div>
|
||||
<div id="vtitl">
|
||||
<span title="Titulo">Agregar Pago :: Pedido No. <?php echo $_smarty_tpl->getVariable('info')->value['noPedido'];?>
|
||||
</span>
|
||||
<br />
|
||||
Factura: <?php echo $_smarty_tpl->getVariable('info')->value['folioProv'];?>
|
||||
|
||||
<br />
|
||||
Saldo: $<?php echo number_format($_smarty_tpl->getVariable('info')->value['saldo'],2,'.',',');?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="draganddrop" style="position:absolute;top:45px;left:640px">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/draganddrop.png" border="0" alt="mueve" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/forms/agregar-pago.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-05-06 10:41:37
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/devoluciones-header.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1172723804536902b19fcaf2-66012218%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'1205095a2ba885ce0723933c08a3afcd9a5629a0' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/devoluciones-header.tpl',
|
||||
1 => 1375965374,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1172723804536902b19fcaf2-66012218',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div class="clear"></div>
|
||||
<!--THIS IS A WIDE PORTLET-->
|
||||
<div class="portlet">
|
||||
|
||||
<div class="portlet-content nopadding">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80" scope="col"><div align="center">No.</div></th>
|
||||
<th width="150" scope="col"><div align="center">Sucursal</div></th>
|
||||
<th width="" scope="col"><div align="center">Usuario</div></th>
|
||||
<th width="100" scope="col"><div align="center">Fecha</div></th>
|
||||
<th width="100" scope="col"><div align="center">Total</div></th>
|
||||
<th width="100" scope="col"><div align="center">Status</div></th>
|
||||
<th width="60" scope="col"><div align="center">Acciones</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 08:53:15
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/status_open.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:8061366095361004bc956d6-17104369%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'1376ea34ce0741056268b0cca975921d2ec0ec37' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/boxes/status_open.tpl',
|
||||
1 => 1375965230,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '8061366095361004bc956d6-17104369',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="centeredDiv" class="" style="margin:auto; position:fixed; top:50%; left:50%; margin-top:-150px;margin-left:-275px;z-index:3000; display:none">
|
||||
<div style="width:548px; border:solid; border-color:#999;border-width:1px; background-color:#ccc; padding-left:5px; padding-top:5px; padding-bottom:5px">
|
||||
<div style="width:500px; border:solid; border-color:#999;border-width:1px; background-color:#FFF; padding:20px">
|
||||
<div id="close_icon" style="position:absolute;top: 40px; left: 500px; z-index:5000; cursor:pointer" onclick="ToogleStatusDiv()"><img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/close_icon.gif" /></div>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-04 13:31:08
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/enumProdCatPromo.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1626918278538f65ec6a1218-89435290%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'15a14e2d64031c9e1715332e2feedf95eacf3074' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/enumProdCatPromo.tpl',
|
||||
1 => 1401906170,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1626918278538f65ec6a1218-89435290',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('categorias')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<input type="checkbox" name="idProdCat[]" value="<?php echo $_smarty_tpl->getVariable('item')->value['prodCatId'];?>
|
||||
" <?php if ($_smarty_tpl->getVariable('item')->value['checked']){?>checked<?php }?>><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</option>
|
||||
<br />
|
||||
<?php }} ?>
|
||||
@@ -0,0 +1,277 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2015-02-26 16:04:12
|
||||
compiled from "/var/www/html/templates/forms/editar-proveedor.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:128535820154ef985cb0e302-10113112%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'16122ef15d73822f822458a4cbef9daa770779a7' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/forms/editar-proveedor.tpl',
|
||||
1 => 1410130451,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '128535820154ef985cb0e302-10113112',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<div id="divForm">
|
||||
<form id="editarProveedorForm" name="editarProveedorForm" method="post">
|
||||
<input type="hidden" id="proveedorId" name="proveedorId" value="<?php echo $_smarty_tpl->getVariable('post')->value['proveedorId'];?>
|
||||
"/>
|
||||
<fieldset>
|
||||
<div class="a">
|
||||
<div class="l">* Numero de Proveedor:</div>
|
||||
<div class="r"><input value="<?php echo $_smarty_tpl->getVariable('post')->value['noProv'];?>
|
||||
" type="text" name="noProv" id="noProv" maxlength="13" class="largeInput">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">* RFC y Homoclave:</div>
|
||||
<div class="r"><input type="text" name="rfc" id="rfc" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['rfc'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">* Nombre Completo o Razón Social:</div>
|
||||
<div class="r"><input type="text" name="nombre" id="nombrenuv" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['nombre'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div align="center"><b>.:: Dirección Fiscal ::.</b></div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Dirección:</div>
|
||||
<div class="r"><input type="text" name="calle" id="calle" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['calle'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">No Exterior:</div>
|
||||
<div class="r"><input type="text" name="noExt" id="noExt" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['noExt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">No Interior:</div>
|
||||
<div class="r"><input type="text" name="noInt" id="noInt" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['noInt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Referencia:</div>
|
||||
<div class="r"><input type="text" name="referencia" id="referencia" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['referencia'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Colonia:</div>
|
||||
<div class="r"><input type="text" name="colonia" id="colonia" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['colonia'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Localidad:</div>
|
||||
<div class="r"><input type="text" name="localidad" id="localidad" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['localidad'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Municipio o Delegación:</div>
|
||||
<div class="r"><input type="text" name="municipio" id="municipio" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['municipio'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Estado:</div>
|
||||
<div class="r"><input type="text" name="estado" id="estado" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['estado'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Pais:</div>
|
||||
<div class="r"><input type="text" name="pais" id="pais" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['pais'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Código Postal:</div>
|
||||
<div class="r"><input type="text" name="codigoPostal" id="codigoPostal" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['codigoPostal'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div align="center"><b>.:: Contacto Ventas ::.</b></div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Nombre Completo:</div>
|
||||
<div class="r"><input type="text" name="nombreVtas" id="nombreVtas" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['nombreVtas'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Oficina:</div>
|
||||
<div class="r"><input type="telefonoVtas" name="telefonoVtas" id="calle" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['telefonoVtas'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Celular:</div>
|
||||
<div class="r"><input type="text" name="celularVtas" id="celularVtas" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['celularVtas'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Correo electrónico:</div>
|
||||
<div class="r"><input type="text" name="emailVtas" id="emailVtas" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['emailVtas'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div align="center"><b>.:: Contacto Pagos ::.</b></div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Nombre Completo:</div>
|
||||
<div class="r"><input type="text" name="nombrePagos" id="nombrePagos" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['nombrePagos'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Oficina:</div>
|
||||
<div class="r"><input type="telefonoPagos" name="telefonoPagos" id="calle" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['telefonoPagos'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Celular:</div>
|
||||
<div class="r"><input type="text" name="celularPagos" id="celularPagos" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['celularPagos'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Correo electrónico:</div>
|
||||
<div class="r"><input type="text" name="emailPagos" id="emailPagos" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['emailPagos'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div align="center"><b>.:: Contacto Entregas ::.</b></div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Nombre Completo:</div>
|
||||
<div class="r"><input type="text" name="nombreEnt" id="nombreEnt" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['nombreEnt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Oficina:</div>
|
||||
<div class="r"><input type="telefonoEnt" name="telefonoEnt" id="calle" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['telefonoEnt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Teléfono Celular:</div>
|
||||
<div class="r"><input type="text" name="celularEnt" id="celularEnt" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['celularEnt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Correo electrónico:</div>
|
||||
<div class="r"><input type="text" name="emailEnt" id="emailEnt" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['emailEnt'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div align="center"><b>.:: Datos Bancarios ::.</b></div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Banco:</div>
|
||||
<div class="r"><input type="text" name="banco" id="banco" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['banco'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">No. de Cuenta:</div>
|
||||
<div class="r"><input type="text" name="noCuenta" id="noCuenta" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['noCuenta'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">CLABE:</div>
|
||||
<div class="r"><input type="text" name="clabe" id="clabe" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['clabe'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Dirección de Almacén</div>
|
||||
<div class="r"><input type="text" name="almacen" id="almacen" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['almacen'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Plazo</div>
|
||||
<div class="r">
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/enumPlazo.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">% Publicidad</div>
|
||||
<div class="r">
|
||||
<input type="text" value="<?php echo $_smarty_tpl->getVariable('post')->value['publicidad'];?>
|
||||
" name="publicidad" class="largeInput wide2" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">% Flete</div>
|
||||
<div class="r"><input type="text" name="flete" id="flete" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['flete'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">% Desarrollo</div>
|
||||
<div class="r"><input type="text" name="desarrollo" id="desarrollo" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['desarrollo'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">% Especial</div>
|
||||
<div class="r"><input type="text" name="especial" id="especial" class="largeInput wide2" value="<?php echo $_smarty_tpl->getVariable('post')->value['especial'];?>
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div class="l">Compra en Firme</div>
|
||||
<div class="r">
|
||||
<select id="compraFirme" name="compraFirme" class="largeInput">
|
||||
<option value="Si" <?php if ($_smarty_tpl->getVariable('post')->value['compraFirme']=="Si"){?> selected="selected"<?php }?> >Si</option>
|
||||
<option value="No" <?php if ($_smarty_tpl->getVariable('post')->value['compraFirme']=="No"){?> selected="selected"<?php }?>>No</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
<hr />
|
||||
* Campos requeridos
|
||||
<div class="formLine" style="text-align:center; padding-left:290px">
|
||||
<a class="button" id="editarProveedor" name="editarProveedor"><span>Actualizar</span></a>
|
||||
</div>
|
||||
<input type="hidden" id="type" name="type" value="saveEditProveedor"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-04-30 10:28:13
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/metodos-pago-base.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:130076265361168d4cf219-32718369%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'162ff35f7b9914188e759dd3844bc7df99f7bd81' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/items/metodos-pago-base.tpl',
|
||||
1 => 1375965383,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '130076265361168d4cf219-32718369',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<tr>
|
||||
<td align="center"><div align="center"><?php echo $_smarty_tpl->getVariable('item')->value['metodoPagoId'];?>
|
||||
</div></td>
|
||||
<td><?php echo $_smarty_tpl->getVariable('item')->value['nombre'];?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/edit.gif" class="spanEdit" id="<?php echo $_smarty_tpl->getVariable('item')->value['metodoPagoId'];?>
|
||||
" title="Editar"/>
|
||||
<img src="<?php echo $_smarty_tpl->getVariable('WEB_ROOT')->value;?>
|
||||
/images/icons/delete.gif" class="spanDelete" id="<?php echo $_smarty_tpl->getVariable('item')->value['metodoPagoId'];?>
|
||||
" title="Eliminar"/>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-15 11:03:49
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/motivo-cancelacion.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:1589355072539dc3e5b58b57-62345507%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'16858d9b7fe34743fa22ab8b9885fbc966946892' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/forms/motivo-cancelacion.tpl',
|
||||
1 => 1375965287,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '1589355072539dc3e5b58b57-62345507',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<!-- Form -->
|
||||
|
||||
<div class="m">
|
||||
|
||||
<form name="frmCancelar" id="frmCancelar" method="post" action="">
|
||||
<input type="hidden" name="type" value="cancelarFactura" />
|
||||
<input type="hidden" name="comprobanteId" value="<?php echo $_smarty_tpl->getVariable('comprobanteId')->value;?>
|
||||
" />
|
||||
<fieldset>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">Motivo de la cancelacion *</div>
|
||||
<div class="r">
|
||||
<textarea name="motivo" id="motivo" class="largeInput wide2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a">
|
||||
<div class="l">
|
||||
* Campos requeridos
|
||||
</div>
|
||||
<div class="r" style="margin-left:300px">
|
||||
<a class="button" id="btnCancelar" name="btnCancelar"><span>Cancelar</span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<div class="a">
|
||||
<br />
|
||||
<div class="l">
|
||||
** El proceso puede llevar varios segundos.
|
||||
<br />
|
||||
** Favor de ser paciente y no dar click 2 veces en el botón.
|
||||
</div>
|
||||
</div>
|
||||
<div class="a">
|
||||
<div id="txtMsg"></div>
|
||||
</div>
|
||||
|
||||
<div class="a"></div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- End Form -->
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2014-06-04 09:57:46
|
||||
compiled from "/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/clientes.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:179244588538f33ea6b9307-19067276%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'1689b0f5fce9d4182465f94dada22b143498432e' =>
|
||||
array (
|
||||
0 => '/home/novomoda/domains/novomoda.com.mx/public_html/sistema/templates/lists/clientes.tpl',
|
||||
1 => 1375965420,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '179244588538f33ea6b9307-19067276',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/clientes-header.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
|
||||
<?php if (count($_smarty_tpl->getVariable('clientes')->value['items'])){?>
|
||||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable;
|
||||
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
|
||||
$_from = $_smarty_tpl->getVariable('clientes')->value['items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||||
if (count($_from) > 0){
|
||||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||||
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
|
||||
?>
|
||||
<?php if ($_smarty_tpl->getVariable('key')->value%2==0){?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/clientes-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"Off"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }else{ ?>
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/items/clientes-base.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('clase',"On"); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
|
||||
<?php }?>
|
||||
<?php }} ?>
|
||||
<?php }else{ ?>
|
||||
<tr><td colspan="3" align="center">Ningún registro encontrado.</td>
|
||||
<?php }?>
|
||||
|
||||
<?php $_template = new Smarty_Internal_Template("{$_smarty_tpl->getVariable('DOC_ROOT')->value}/templates/lists/pages_new.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
|
||||
$_template->assign('pages',$_smarty_tpl->getVariable('clientes')->value['pages']);$_template->assign('colspan',3); echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php /* Smarty version Smarty3-b7, created on 2015-02-26 16:04:12
|
||||
compiled from "/var/www/html/templates/lists/enumPlazo.tpl" */ ?>
|
||||
<?php /*%%SmartyHeaderCode:166049318954ef985cc82bc7-50321242%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||||
$_smarty_tpl->decodeProperties(array (
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'169bf80659c542e5a937706df76c426e33412809' =>
|
||||
array (
|
||||
0 => '/var/www/html/templates/lists/enumPlazo.tpl',
|
||||
1 => 1410130458,
|
||||
),
|
||||
),
|
||||
'nocache_hash' => '166049318954ef985cc82bc7-50321242',
|
||||
'function' =>
|
||||
array (
|
||||
),
|
||||
'has_nocache_code' => false,
|
||||
)); /*/%%SmartyHeaderCode%%*/?>
|
||||
<select name="plazo" id="plazo" class="largeInput" style="width:300px">
|
||||
<option value="">Seleccione</option>
|
||||
<option value="15" <?php if ($_smarty_tpl->getVariable('post')->value['plazo']=="15"){?>selected<?php }?>>15</option>
|
||||
<option value="30" <?php if ($_smarty_tpl->getVariable('post')->value['plazo']=="30"){?>selected<?php }?>>30</option>
|
||||
<option value="45" <?php if ($_smarty_tpl->getVariable('post')->value['plazo']=="45"){?>selected<?php }?>>45</option>
|
||||
<option value="60" <?php if ($_smarty_tpl->getVariable('post')->value['plazo']=="60"){?>selected<?php }?>>60</option>
|
||||
</select>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user