Las extensiones para trabajar en los proyectos actuales de MedicalSoft, Punto de venta ETC, son las siguientes
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=mbstring
;extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=oci8_19 ; Use with Oracle Database 19 Instant Client
extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop
extension=php_pdo_sqlsrv_82_nts_x64.dll
; The MIBS data available in the PHP distribution must be installed.
; See https://www.php.net/manual/en/snmp.installation.php
;extension=snmp
extension=soap
;extension=sockets
;extension=sodium
extension=sqlite3
;extension=tidy
extension=xsl
extension=zip
Una de la extensiones requeridas en nuestro caso y como puede ser en el caso de ustedes es poder conectar SQL server Con PHP 8.2 asi que les mostraremos como instalarlo correctamente, suponiendo que tenemos instalado PHP 8.2 en Windows 10
Posteriormente vamos a necesitar el catalogo de tipo de vehículos y vehículos en esta publicación dejaremos la forma para crear el CRUD de tipos de vehículos con los siguientes datos.
Para registrar los movimientos requerimos especificar que tipo de movimiento es como puede ser entradas por compra, salidas por venta, entrada por devolución de cliente, saluda por devolución a proveedor
Para ello crearemos el siguiente catalogo de Tipos de movimiento con los siguientes campos
Empresa
Descripción
tipo
Es traspaso
Primero creamos el archivo de migración App/Database/2023-08-17222335_Tipos_movimientos_inventario.php con el siguiente código
Creamos el archivo de lenguaje en español en App/Languaje/es/proveedores.php con el siguiente código.
<?php
$proveedores["logDescription"] = "El registro en proveedores fue guardado con los siguientes datos:";
$proveedores["logUpdate"] = "El registro en proveedores fue actualizado con los siguientes datos:";
$proveedores["logDeleted"] = "El registro en proveedores fue eliminado con los siguientes datos:";
$proveedores["msg_delete"] = "El Registro en clieproveedoresntes fue eliminado correctamente:";
$proveedores["add"] = "Agregar Proveedor";
$proveedores["edit"] = "Editar Proveedor";
$proveedores["createEdit"] = "Crear / Editar";
$proveedores["title"] = "Admon. Proveedores";
$proveedores["subtitle"] = "Lista de Proveedores";
$proveedores["fields"]["firstname"] = "Nombre";
$proveedores["fields"]["lastname"] = "Apellido";
$proveedores["fields"]["taxID"] = "RFC";
$proveedores["fields"]["email"] = "Correo Electronico";
$proveedores["fields"]["direction"] = "Direccion";
$proveedores["fields"]["birthdate"] = "Fecha de nacimiento";
$cusproveedorestumers["fields"]["created_at"] = "Fecha de creacion";
$proveedores["fields"]["updated_at"] = "Ultima modificacion";
$proveedores["fields"]["deleted_at"] = "Fecha de eliminacion";
$proveedores["fields"]["actions"] = "Acciones";
$proveedores["msg"]["msg_insert"] = "Registro agregado correctamente.";
$proveedores["msg"]["msg_update"] = "Registro modificado correctamente.";
$proveedores["msg"]["msg_delete"] = "Registro eliminado correctamente.";
$proveedores["msg"]["msg_get"] = "Registro obtenido correctamente.";
$proveedores["msg"]["msg_get_fail"] = "Registro no encontrado o eliminado.";
return $proveedores;
Creamos el archivo de lenguaje en ingles en App/Languaje/en/proveedores.php con el siguiente código.
<?php
$proveedores["logDescription"] = "The custumers was saved with the following data:";
$proveedores["logUpdate"] = "The custumers was updated with the following data:";
$proveedores["logDeleted"] = "The custumers was deleted with the following data:";
$proveedores["msg_delete"] = "The custumers was deleted correctly:";
$proveedores["add"] = "Add Vendor";
$proveedores["edit"] = "Edit Vendor";
$proveedores["createEdit"] = "Create / Edit";
$proveedores["title"] = "Vendors management";
$proveedores["subtitle"] = "Vendors list";
$proveedores["fields"]["firstname"] = "Firstname";
$proveedores["fields"]["lastname"] = "Lastname";
$proveedores["fields"]["taxID"] = "TaxID";
$proveedores["fields"]["email"] = "Email";
$proveedores["fields"]["direction"] = "Direction";
$proveedores["fields"]["birthdate"] = "Birthdate";
$proveedores["fields"]["created_at"] = "Created_at";
$proveedores["fields"]["updated_at"] = "Updated_at";
$proveedores["fields"]["deleted_at"] = "Deleted_at";
$proveedores["fields"]["actions"] = "Actions";
$proveedores["msg"]["msg_insert"] = "The Vendor has been correctly added.";
$proveedores["msg"]["msg_update"] = "The Vendor has been correctly modified.";
$proveedores["msg"]["msg_delete"] = "The Vendor has been correctly deleted.";
$proveedores["msg"]["msg_get"] = "The Vendor has been successfully get.";
$proveedores["msg"]["msg_get_fail"] = "The Vendor not found or already deleted.";
return $proveedores;
En App/Config/Routes.php en el grupo admin agregamos las siguientes rutas
Ya vimos como usar AutoCrud para crear los catálogos, en esta ocasión tambien usamos autocrud, aun así dejaremos el código fuente completo de este modulo
Creamos el archivo modelo al app/models/CustumersModel.php con el siguiente contenido
Para la traducción en ingles creamos el archivo app/languaje/es/custumers.php con el siguiente contenido
<?php
$custumers["logDescription"] = "The custumers was saved with the following data:";
$custumers["logUpdate"] = "The custumers was updated with the following data:";
$custumers["logDeleted"] = "The custumers was deleted with the following data:";
$custumers["msg_delete"] = "The custumers was deleted correctly:";
$custumers["add"] = "Add Custumers";
$custumers["edit"] = "Edit custumers";
$custumers["createEdit"] = "Create / Edit";
$custumers["title"] = "custumers management";
$custumers["subtitle"] = "custumers list";
$custumers["fields"]["firstname"] = "Firstname";
$custumers["fields"]["lastname"] = "Lastname";
$custumers["fields"]["taxID"] = "TaxID";
$custumers["fields"]["email"] = "Email";
$custumers["fields"]["direction"] = "Direction";
$custumers["fields"]["birthdate"] = "Birthdate";
$custumers["fields"]["created_at"] = "Created_at";
$custumers["fields"]["updated_at"] = "Updated_at";
$custumers["fields"]["deleted_at"] = "Deleted_at";
$custumers["fields"]["actions"] = "Actions";
$custumers["msg"]["msg_insert"] = "The custumers has been correctly added.";
$custumers["msg"]["msg_update"] = "The custumers has been correctly modified.";
$custumers["msg"]["msg_delete"] = "The custumers has been correctly deleted.";
$custumers["msg"]["msg_get"] = "The Custumers has been successfully get.";
$custumers["msg"]["msg_get_fail"] = "The custumers not found or already deleted.";
return $custumers;
Para nuestra traduccion en español creamos el archivo app/languaje/es/custumers.php
<?php
$custumers["logDescription"] = "El registro en clientes fue guardado con los siguientes datos:";
$custumers["logUpdate"] = "El registro en clientes fue actualizado con los siguientes datos:";
$custumers["logDeleted"] = "El registro en clientes fue eliminado con los siguientes datos:";
$custumers["msg_delete"] = "El Registro en clientes fue eliminado correctamente:";
$custumers["add"] = "Agregar Cliente";
$custumers["edit"] = "Editar Cliente";
$custumers["createEdit"] = "Crear / Editar";
$custumers["title"] = "Admon. Clientes";
$custumers["subtitle"] = "Lista de Clientes";
$custumers["fields"]["firstname"] = "Nombre";
$custumers["fields"]["lastname"] = "Apellido";
$custumers["fields"]["taxID"] = "RFC";
$custumers["fields"]["email"] = "Correo Electronico";
$custumers["fields"]["direction"] = "Direccion";
$custumers["fields"]["birthdate"] = "Fecha de nacimiento";
$custumers["fields"]["created_at"] = "Fecha de creacion";
$custumers["fields"]["updated_at"] = "Ultima modificacion";
$custumers["fields"]["deleted_at"] = "Fecha de eliminacion";
$custumers["fields"]["actions"] = "Acciones";
$custumers["msg"]["msg_insert"] = "Registro agregado correctamente.";
$custumers["msg"]["msg_update"] = "Registro modificado correctamente.";
$custumers["msg"]["msg_delete"] = "Registro eliminado correctamente.";
$custumers["msg"]["msg_get"] = "Registro obtenido correctamente.";
$custumers["msg"]["msg_get_fail"] = "Registro no encontrado o eliminado.";
return $custumers;
Creamos nuestro archivo de migración en app/databases/migrations/2023-04-21063335_Custumers.php con el siguiente contenido
Ya vimos como crear módulos y catalogo ahora mostraremos como automatizar esa parte del proceso de desarrollo para ser un poco mas eficientes para ello escribimos un código que escribe el código repetitivo
Creamos el archivo app/controller/AutoCrudController.php con el siguiente código
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 21-04-2023 a las 20:19:25
-- Versión del servidor: 10.4.17-MariaDB
-- Versión de PHP: 7.4.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `ci4jcpos`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `categorias`
--
CREATE TABLE `categorias` (
`id` int(11) NOT NULL,
`descripcion` varchar(128) COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish2_ci;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `categorias`
--
ALTER TABLE `categorias`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `categorias`
--
ALTER TABLE `categorias`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Corremos la siguiente URL en el navegador para crear todo el catalogo
Para la tabla donde se guardara la información corremos el siguiente código SQL en PHPMYADMIN en nuestra base de datos, en publicaciones posteriores les dejare los archivos de migración para que no tengan la necesidad de correr archivos SQL y sirva para diferentes motores de base de datos
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 18-04-2023 a las 00:56:17
-- Versión del servidor: 10.4.17-MariaDB
-- Versión de PHP: 7.4.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `wheelsoft`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `mailsettings`
--
CREATE TABLE `mailsettings` (
`id` int(11) NOT NULL,
`email` varchar(512) DEFAULT NULL,
`host` varchar(128) DEFAULT NULL,
`smtpDebug` varchar(16) DEFAULT NULL,
`SMTPAuth` varchar(16) DEFAULT NULL,
`port` varchar(16) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`smptSecurity` varchar(64) DEFAULT NULL,
`pass` varchar(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `mailsettings`
--
INSERT INTO `mailsettings` (`id`, `email`, `host`, `smtpDebug`, `SMTPAuth`, `port`, `created_at`, `deleted_at`, `updated_at`, `smptSecurity`, `pass`) VALUES
(1, 'mail@domain.com', 'mail.host5.com', '1', '1', '587', NULL, NULL, NULL, 'tls', 'password');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `mailsettings`
--
ALTER TABLE `mailsettings`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `mailsettings`
--
ALTER TABLE `mailsettings`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Creamos el archivo app/controllers/SettingsMailController.php con el siguiente contenido
<?php
namespace julio101290\boilerplate\Controllers\Users;
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use App\Models\SettingsMailModel;
use App\Models\LogModel;
use julio101290\boilerplate\Controllers\BaseController;
use julio101290\boilerplate\Entities\Collection;
use julio101290\boilerplate\Models\GroupModel;
use CodeIgniter\Config\Services;
use App\Models\RegisterModel;
use App\Controllers\RegisterController;
use PHPMailer\PHPMailer;
/**
* Class UserController.
*/
class SettingsMailController extends BaseController
{
use ResponseTrait;
/** @var \agungsugiarto\boilerplate\Models\GroupModel */
protected $group;
protected $settingsMail;
protected $log;
protected $register;
protected $registerController;
protected $custumer;
/** @var \agungsugiarto\boilerplate\Models\UserModel */
protected $users;
public function __construct()
{
$this->group = new GroupModel();
$this->log = new LogModel();
$this->settingsMail = new SettingsMailModel();
$autorize = $this->authorize = Services::authorization();
helper('menu');
}
public function index()
{
$datos = $this->settingsMail->where("id", 1)->first();
$data["title"] = "Correo Electronicos";
$data["subtitle"] = "Configuraciones de Correo Electronico";
$data["data"] = $datos;
return view('mailSettings', $data);
}
/**
public function sendMailPDF($uuid)
{
//DATOS CORREO
$datos = $this->settingsMail->where("id", 1)->first();
//DATOS REGISTRO
$register = $this->register->select("*")->where("uuid", $uuid)->first();
$custumer = $this->custumer->select("*")->where("id", $register["custumer"])->first();
$mailsTarjets = "";
$correo = $datos["email"];
$SMTPDebug = $datos["smtpDebug"];
$host = $datos["host"];
if ($datos["SMTPAuth"] == 1) {
$SMTPAuth = true;
} else {
$SMTPAuth = false;
}
$puerto = $datos["port"];
$clave = $datos["pass"];
$SMTPSeguridad = $datos["smptSecurity"];
// Load Composer's autoloader
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer\PHPMailer();
try {
//Server settings
$mail->SMTPDebug = $SMTPDebug; // Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = $host; // Set the SMTP server to send through
$mail->SMTPAuth = $SMTPAuth; // Enable SMTP authentication
$mail->Username = $correo; // SMTP username
$mail->Password = $clave; // SMTP password
$mail->SMTPSecure = $SMTPSeguridad; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
$mail->Port = $puerto;
$nombreEmpresa = "";
// TCP port to connect to
//Recipients
$mail->setFrom($correo, $nombreEmpresa);
if ($custumer["email1"] != "") {
try {
$mailAddress = $mail->addAddress($custumer["email1"], '');
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
if ($custumer["email2"] != "") {
try {
$mailAddress = $mail->addAddress($custumer["email2"], '');
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
if ($custumer["email3"] != "") {
try {
$mailAddress = $mail->addAddress($custumer["email3"], '');
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
if ($custumer["email4"] != "") {
try {
$mailAddress = $mail->addAddress($custumer["email4"], '');
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
if ($custumer["email5"] != "") {
try {
$mailAddress = $mail->addAddress($custumer["email5"], '');
if (!$mailAddress) {
echo "Error con el correo Electronico";
return;
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
// Add a recipient
//$mail->addReplyTo('info@example.com', 'Information');
//mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
// Attachments
$attachment = $this->registerController->report($uuid, 1);
$mail->AddStringAttachment($attachment, 'registro' . $register["codeCustumer"] . '.pdf', 'base64', 'application/pdf');
// Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Envio de Registro";
$mail->Body = "Adjuntamos el registro de verificación de neumaticos";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
try {
$send = $mail->send();
} catch (Exception $ex) {
echo $ex->getMessage();
return;
}
if ($send) {
echo 'Correo Enviado Correctamente';
} else {
echo 'Error al enviar el correo';
}
} catch (Exception $e) {
echo "Error al enviar el correo: {$e->ErrorInfo}";
}
}
*/
public function guardar()
{
helper('auth');
$userName = user()->username;
$idUser = user()->id;
//GUARDA CONFIGURACIONES
$this->settingsMail->update(1, $_POST);
// return redirect()->to("/admin/hospital");
return redirect()->back()->with('sweet-success', 'Actualizado Correctamente');
// return redirect()->back()->with('sweet-success','Guardado Correctamente');
}
}
Creamos el archivo app/views/mailSettings.php con el siguiente contenido
Usamos cookies en nuestro sitio web para brindarle la experiencia más relevante recordando sus preferencias y visitas repetidas. Al hacer clic en "Aceptar", acepta el uso de TODAS las cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.