
--
-- Temporary view structure for view `pagos_atrasados`
--

/*!50001 DROP VIEW IF EXISTS `pagos_atrasados`*/;
/*!50001 CREATE VIEW `pagos_atrasados` AS SELECT 
 1 AS `Nombre`,
 1 AS `Apellido`,
 1 AS `Cedula`,
 1 AS `Dispositivo`,
 1 AS `Vendedor`,
 1 AS `MontoAdeudado`,
 1 AS `CuotasAtrasadas`,
 1 AS `UltimaFechaAtraso`*/;

--
-- Final view structure for view `pagos_atrasados`
--

/*!50001 DROP VIEW IF EXISTS `pagos_atrasados`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`doadmin`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `pagos_atrasados` AS select `U`.`Nombre` AS `Nombre`,`U`.`Apellido` AS `Apellido`,`U`.`Cedula` AS `Cedula`,`D`.`modelo` AS `Dispositivo`,`D`.`vendedor` AS `Vendedor`,`F`.`MontoAdeudado` AS `MontoAdeudado`,count(`C`.`ID`) AS `CuotasAtrasadas`,max(`C`.`FechaCuota`) AS `UltimaFechaAtraso` from (((`Financiamiento` `F` join `Usuarios` `U` on((`F`.`UserID` = `U`.`UserID`))) join `Dispositivos` `D` on((`F`.`DeviceID` = `D`.`id`))) join `Cuotas` `C` on((`F`.`ID` = `C`.`IDFinanciamiento`))) where (`C`.`EstadoCuota` = 'Atrasada') group by `U`.`Cedula`,`F`.`ID` */;


