diff --git a/apc-controller/src/main/java/com/arrebol/apc/controller/system/employee/EmployeeController.java b/apc-controller/src/main/java/com/arrebol/apc/controller/system/employee/EmployeeController.java index 3cf3fda..2c66719 100644 --- a/apc-controller/src/main/java/com/arrebol/apc/controller/system/employee/EmployeeController.java +++ b/apc-controller/src/main/java/com/arrebol/apc/controller/system/employee/EmployeeController.java @@ -1,12 +1,13 @@ /* * Arrebol Consultancy copyright. - * + * * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.controller.system.employee; +import com.arrebol.apc.controller.util.HibernateUtil; import com.arrebol.apc.model.ModelParameter; import com.arrebol.apc.model.admin.Bonus; import com.arrebol.apc.model.admin.constance.BonusCfg; @@ -26,6 +27,9 @@ import java.util.List; import javax.persistence.Tuple; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.Transaction; /** * @@ -33,145 +37,169 @@ import org.apache.logging.log4j.Logger; */ public class EmployeeController implements Serializable { - /** - * Find where status EQUALS TO status. - * - * @param office - * @param status - * @param hrOwnerId Human resource id from user logged. - * @return - */ - public List findEmployeesByType(Office office, HumanResourceStatus status, String hrOwnerId) { - List parameters = new ArrayList<>(); + /** + * Find where status EQUALS TO status. + * + * @param office + * @param status + * @param hrOwnerId Human resource id from user logged. + * @return + */ + public List findEmployeesByType(Office office, HumanResourceStatus status, String hrOwnerId) { + List parameters = new ArrayList<>(); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_OFFICE, office)); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, status)); - parameters.add(new ModelParameter(HumanResourceByOfficeCfg.HUMAN_RESOURCE, new HumanResource(hrOwnerId))); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_OFFICE, office)); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, status)); + parameters.add(new ModelParameter(HumanResourceByOfficeCfg.HUMAN_RESOURCE, new HumanResource(hrOwnerId))); - return genericEntityRepository.xmlQueryAPCEntities(HumanResource.class, HumanResourceCfg.QUERY_FIND_ALL_BY_STATUS, parameters); - } + return genericEntityRepository.xmlQueryAPCEntities(HumanResource.class, HumanResourceCfg.QUERY_FIND_ALL_BY_STATUS, parameters); + } - /** - * Find where status IN status. - * - * @param office - * @param statusLst - * @param hrOwnerId Human resource id from user logged. - * @return - */ - public List findEmployeesInType(Office office, List statusLst, String hrOwnerId) { - List parameters = new ArrayList<>(); + /** + * Find where status IN status. + * + * @param office + * @param statusLst + * @param hrOwnerId Human resource id from user logged. + * @return + */ + public List findEmployeesInType(Office office, List statusLst, String hrOwnerId) { + List parameters = new ArrayList<>(); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_OFFICE, office)); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, statusLst)); - parameters.add(new ModelParameter(HumanResourceByOfficeCfg.HUMAN_RESOURCE, new HumanResource(hrOwnerId))); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_OFFICE, office)); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, statusLst)); + parameters.add(new ModelParameter(HumanResourceByOfficeCfg.HUMAN_RESOURCE, new HumanResource(hrOwnerId))); - return genericEntityRepository.xmlQueryAPCEntities(HumanResource.class, HumanResourceCfg.QUERY_FIND_ALL_IN_STATUS, parameters); - } + return genericEntityRepository.xmlQueryAPCEntities(HumanResource.class, HumanResourceCfg.QUERY_FIND_ALL_IN_STATUS, parameters); + } - /** - * Save an entity. - * - * @param humanResourceByOffice - * @param humanResource - * @return - */ - public boolean saveHRController(HumanResourceByOffice humanResourceByOffice, HumanResource humanResource) { - logger.debug("saveHRController"); + /** + * Save an entity. + * + * @param humanResourceByOffice + * @param humanResource + * @return + */ + public boolean saveHRController(HumanResourceByOffice humanResourceByOffice, HumanResource humanResource) { + logger.debug("saveHRController"); - boolean success = genericEntityRepository.insertAPCEntity(humanResource); + boolean success = genericEntityRepository.insertAPCEntity(humanResource); - if (success) { - humanResourceByOffice.setHumanResource(new HumanResource(humanResource.getId())); - success = genericEntityRepository.insertAPCEntity(humanResourceByOffice); - } + if (success) { + humanResourceByOffice.setHumanResource(new HumanResource(humanResource.getId())); + success = genericEntityRepository.insertAPCEntity(humanResourceByOffice); + } - return success; - } + return success; + } - /** - * - * @param hr - * @param updateAvatar - * @return - */ - public boolean updateByHumanResourceId(HumanResource hr, boolean updateAvatar) { - logger.debug("updateByHumanResourceId"); + /** + * + * @param hr + * @param updateAvatar + * @return + */ + public boolean updateByHumanResourceId(HumanResource hr, boolean updateAvatar) { + logger.debug("updateByHumanResourceId"); - return humanResourceRepository.updateByHumanResourceId(hr, updateAvatar); - } + return humanResourceRepository.updateByHumanResourceId(hr, updateAvatar); + } - /** - * - * @param status - * @param userIdToUpdate - * @param lastUpdatedBy - * @return - */ - public boolean updateHRByStatus(HumanResourceStatus status, String userIdToUpdate, String lastUpdatedBy) { - logger.debug("updateHRByStatus"); + /** + * + * @param status + * @param userIdToUpdate + * @param lastUpdatedBy + * @return + */ + public boolean updateHRByStatus(HumanResourceStatus status, String userIdToUpdate, String lastUpdatedBy) { + logger.debug("updateHRByStatus"); - List parameters = new ArrayList<>(); + List parameters = new ArrayList<>(); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, status)); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy)); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_LAST_UPDATED_ON, new Date())); - parameters.add(new ModelParameter(HumanResourceCfg.FIELD_ID, userIdToUpdate)); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, status)); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy)); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_LAST_UPDATED_ON, new Date())); + parameters.add(new ModelParameter(HumanResourceCfg.FIELD_ID, userIdToUpdate)); - return genericEntityRepository.xmlUpdateOrDeleteAPCEntity(HumanResourceCfg.UPDATE_HR_BY_STATUS, parameters); - } + return genericEntityRepository.xmlUpdateOrDeleteAPCEntity(HumanResourceCfg.UPDATE_HR_BY_STATUS, parameters); + } - /** - * - * @param officeId - * @return - */ - public List findAllActiveBonus(String officeId) { - logger.debug("findAllActiveBonus"); + /** + * + * @param officeId + * @return + */ + public List findAllActiveBonus(String officeId) { + logger.debug("findAllActiveBonus"); - List results = new ArrayList<>(); - try { - List parameters = new ArrayList<>(); + List results = new ArrayList<>(); + try { + List parameters = new ArrayList<>(); - parameters.add(new ModelParameter(BonusCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED)); - parameters.add(new ModelParameter(BonusCfg.FIELD_OFFICE, new Office(officeId))); + parameters.add(new ModelParameter(BonusCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED)); + parameters.add(new ModelParameter(BonusCfg.FIELD_OFFICE, new Office(officeId))); - List tuples = genericEntityRepository.xmlQueryAPCEntities( - Tuple.class, - BonusCfg.QUERY_FIND_ALL_ACTIVE_BONUS, - parameters); + List tuples = genericEntityRepository.xmlQueryAPCEntities( + Tuple.class, + BonusCfg.QUERY_FIND_ALL_ACTIVE_BONUS, + parameters); - tuples.forEach((tuple) -> { - results.add(new Bonus(tuple.get("id").toString(), tuple.get("name").toString())); - }); + tuples.forEach((tuple) -> { + results.add(new Bonus(tuple.get("id").toString(), tuple.get("name").toString())); + }); - } catch (Exception e) { - logger.error("findAllActiveBonus", e); - } + } catch (Exception e) { + logger.error("findAllActiveBonus", e); + } - return results; - } + return results; + } - /** - * - * @param hrId - * @return - */ - public HumanResource findHumanResourceById(String hrId) { - logger.debug("findHumanResourceById"); + public boolean verificarIdentificadorFolio(String identificadorFolio) { + logger.info("verificarIdentificadorFolio"); + boolean success = true; + Transaction transaction = null; + try { + Session session = HibernateUtil.getSessionFactory().getCurrentSession(); + transaction = session.beginTransaction(); + String query = "SELECT COUNT(hr.id) " + + "FROM HumanResource hr " + + "WHERE hr.identificadorFolio=:identi "; + Long count = (Long) session.createQuery(query).setParameter("identi", identificadorFolio).uniqueResult(); + if (null != count && count == 0) { + success = false; + } + transaction.commit(); + logger.info("Total of human resource found: " + count); + } catch (HibernateException e) { + logger.error("Can not find human resource", e); + } catch (Exception e) { + logger.error("Method verificarIdentificadorFolio()", e); + } + return success; + } - return (HumanResource) genericEntityRepository.selectAPCEntityById(HumanResource.class, hrId); - } + /** + * + * @param hrId + * @return + */ + public HumanResource findHumanResourceById(String hrId) { + logger.debug("findHumanResourceById"); - private static final long serialVersionUID = 2527037592427439763L; - final Logger logger = LogManager.getLogger(EmployeeController.class); + return (HumanResource) genericEntityRepository.selectAPCEntityById(HumanResource.class, hrId); + } - private final GenericEntityRepository genericEntityRepository; - private final HumanResourceRepository humanResourceRepository; + private static final long serialVersionUID = 2527037592427439763L; + final Logger logger = LogManager.getLogger(EmployeeController.class); - public EmployeeController() { - this.genericEntityRepository = new GenericEntityRepository(); - this.humanResourceRepository = new HumanResourceRepository(); - } + private final GenericEntityRepository genericEntityRepository; + private final HumanResourceRepository humanResourceRepository; + + public EmployeeController() { + this.genericEntityRepository = new GenericEntityRepository(); + this.humanResourceRepository = new HumanResourceRepository(); + } } diff --git a/apc-model/src/main/java/com/arrebol/apc/model/core/HumanResource.java b/apc-model/src/main/java/com/arrebol/apc/model/core/HumanResource.java index 355978e..efbcf0a 100644 --- a/apc-model/src/main/java/com/arrebol/apc/model/core/HumanResource.java +++ b/apc-model/src/main/java/com/arrebol/apc/model/core/HumanResource.java @@ -1,7 +1,7 @@ /* * Arrebol Consultancy copyright * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.model.core; @@ -41,388 +41,388 @@ import org.hibernate.annotations.GenericGenerator; @Table(name = "APC_HUMAN_RESOURCE") public class HumanResource implements Serializable { - private static final long serialVersionUID = -7296859753095844932L; - - @Id - @GeneratedValue(generator = "uuid") - @GenericGenerator(name = "uuid", strategy = "uuid2") - @Column(name = "id", length = 36) - private String id; - - @Column(name = "first_name", length = 25, nullable = false) - private String firstName; - - @Column(name = "second_name", length = 25) - private String secondName; - - @Column(name = "last_name", length = 25, nullable = false) - private String lastName; - - @Column(name = "middle_name", length = 25, nullable = false) - private String middleName; - - @Temporal(TemporalType.DATE) - @Column(name = "birthdate") - private Date birthdate; - - @Column(name = "avatar", length = 150, nullable = false) - private String avatar; - - @Column(name = "curp", length = 20) - private String curp; - - @Column(name = "rfc", length = 13) - private String rfc; - - @Column(name = "ife", length = 20) - private String ife; - - @Temporal(TemporalType.DATE) - @Column(name = "admission_date") - private Date admissionDate; - - @Enumerated(EnumType.STRING) - @Column(name = "human_resource_status", nullable = false) - private HumanResourceStatus humanResourceStatus; - - @ManyToOne(fetch = FetchType.LAZY, optional = false) - @JoinColumn( - name = "id_role", - referencedColumnName = "id", - nullable = false - ) - private RoleCtlg roleCtlg; - - @OneToOne(fetch = FetchType.LAZY) - @JoinColumn( - name = "id_bonus", - referencedColumnName = "id" - ) - private Bonus bonus; - - @Column(name = "payment") - private BigDecimal payment; - - @Column(name = "balance", nullable = false) - private BigDecimal balance; - - @Column(name = "imss") - private BigDecimal imss; - - @Column(name = "employee_saving") - private BigDecimal employeeSaving; - - @Column(name = "created_by", nullable = false, length = 36) - private String createdBy; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "created_on", length = 19) - private Date createdOn; - - @Column(name = "last_updated_by", length = 36) - private String lastUpdatedBy; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "last_updated_on", length = 19) - private Date lastUpdatedOn; - - @OneToOne( - mappedBy = "humanResource", - cascade = CascadeType.ALL, - orphanRemoval = true, - fetch = FetchType.LAZY - ) - private User user; - - @OneToMany( - mappedBy = "humanResource", - cascade = CascadeType.ALL, - fetch = FetchType.LAZY, - orphanRemoval = true - ) - private List humanResourceByOffices; - - @OneToMany( - fetch = FetchType.LAZY, - mappedBy = "humanResource", - orphanRemoval = true, - cascade = CascadeType.ALL - ) - private List humanResourceHasRoutes; - - @OneToMany( - fetch = FetchType.LAZY, - mappedBy = "humanResource", - orphanRemoval = true, - cascade = CascadeType.ALL - ) - private List advances; - - @Transient - private String fullName; - - public HumanResource() { - } - - public HumanResource(String id) { - this.id = id; - } - - /** - * - * @param id - * @param fullName - */ - public HumanResource(String id, String fullName) { - this.id = id; - this.fullName = fullName; - } - - /** - * - * @param id - * @param firstName - * @param lastName - * @param avatar - */ - public HumanResource(String id, String firstName, String lastName, String avatar) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.avatar = avatar; - } - - /** - * - * @param firstName - * @param lastName - * @param avatar - */ - public HumanResource(String firstName, String lastName, String avatar) { - this.firstName = firstName; - this.lastName = lastName; - this.avatar = avatar; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getSecondName() { - return secondName; - } - - public void setSecondName(String secondName) { - this.secondName = secondName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getMiddleName() { - return middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public Date getBirthdate() { - return birthdate; - } - - public void setBirthdate(Date birthdate) { - this.birthdate = birthdate; - } - - public String getAvatar() { - return avatar; - } - - public void setAvatar(String avatar) { - this.avatar = avatar; - } - - public String getCurp() { - return curp; - } - - public void setCurp(String curp) { - this.curp = curp; - } - - public String getRfc() { - return rfc; - } - - public void setRfc(String rfc) { - this.rfc = rfc; - } - - public String getIfe() { - return ife; - } - - public void setIfe(String ife) { - this.ife = ife; - } - - public Date getAdmissionDate() { - return admissionDate; - } - - public void setAdmissionDate(Date admissionDate) { - this.admissionDate = admissionDate; - } - - public HumanResourceStatus getHumanResourceStatus() { - return humanResourceStatus; - } - - public void setHumanResourceStatus(HumanResourceStatus humanResourceStatus) { - this.humanResourceStatus = humanResourceStatus; - } - - public RoleCtlg getRoleCtlg() { - return roleCtlg; - } - - public void setRoleCtlg(RoleCtlg roleCtlg) { - this.roleCtlg = roleCtlg; - } - - public Bonus getBonus() { - return bonus; - } - - public void setBonus(Bonus bonus) { - this.bonus = bonus; - } - - public BigDecimal getBalance() { - return balance; - } - - public void setBalance(BigDecimal balance) { - this.balance = balance; - } - - public BigDecimal getEmployeeSaving() { - return employeeSaving; - } - - public void setEmployeeSaving(BigDecimal employeeSaving) { - this.employeeSaving = employeeSaving; - } - - public BigDecimal getPayment() { - return payment; - } - - public void setPayment(BigDecimal payment) { - this.payment = payment; - } - - public BigDecimal getImss() { - return imss; - } - - public void setImss(BigDecimal imss) { - this.imss = imss; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public Date getCreatedOn() { - return createdOn; - } - - public void setCreatedOn(Date createdOn) { - this.createdOn = createdOn; - } - - public String getLastUpdatedBy() { - return lastUpdatedBy; - } - - public void setLastUpdatedBy(String lastUpdatedBy) { - this.lastUpdatedBy = lastUpdatedBy; - } - - public Date getLastUpdatedOn() { - return lastUpdatedOn; - } - - public void setLastUpdatedOn(Date lastUpdatedOn) { - this.lastUpdatedOn = lastUpdatedOn; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public List getHumanResourceByOffices() { - return humanResourceByOffices; - } - - public void setHumanResourceByOffices(List humanResourceByOffices) { - this.humanResourceByOffices = humanResourceByOffices; - } - - public List getHumanResourceHasRoutes() { - return humanResourceHasRoutes; - } - - public void setHumanResourceHasRoutes(List humanResourceHasRoutes) { - this.humanResourceHasRoutes = humanResourceHasRoutes; - } - - public List getAdvances() { - return advances; - } - - public void setAdvances(List advances) { - this.advances = advances; - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - @Override - public String toString() { - return "HumanResource{" + "firstName=" + firstName + ", secondName=" + secondName + ", lastName=" + lastName + ", middleName=" + middleName + '}'; - } + private static final long serialVersionUID = -7296859753095844932L; + + @Id + @GeneratedValue(generator = "uuid") + @GenericGenerator(name = "uuid", strategy = "uuid2") + @Column(name = "id", length = 36) + private String id; + + @Column(name = "first_name", length = 25, nullable = false) + private String firstName; + + @Column(name = "second_name", length = 25) + private String secondName; + + @Column(name = "last_name", length = 25, nullable = false) + private String lastName; + + @Column(name = "middle_name", length = 25, nullable = false) + private String middleName; + + @Temporal(TemporalType.DATE) + @Column(name = "birthdate") + private Date birthdate; + + @Column(name = "avatar", length = 150, nullable = false) + private String avatar; + + @Column(name = "curp", length = 20) + private String curp; + + @Column(name = "rfc", length = 13) + private String rfc; + + @Column(name = "ife", length = 20) + private String ife; + + @Temporal(TemporalType.DATE) + @Column(name = "admission_date") + private Date admissionDate; + + @Enumerated(EnumType.STRING) + @Column(name = "human_resource_status", nullable = false) + private HumanResourceStatus humanResourceStatus; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn( + name = "id_role", + referencedColumnName = "id", + nullable = false + ) + private RoleCtlg roleCtlg; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "id_bonus", + referencedColumnName = "id" + ) + private Bonus bonus; + + @Column(name = "payment") + private BigDecimal payment; + + @Column(name = "balance", nullable = false) + private BigDecimal balance; + + @Column(name = "imss") + private BigDecimal imss; + + @Column(name = "employee_saving") + private BigDecimal employeeSaving; + + @Column(name = "created_by", nullable = false, length = 36) + private String createdBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "created_on", length = 19) + private Date createdOn; + + @Column(name = "last_updated_by", length = 36) + private String lastUpdatedBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "last_updated_on", length = 19) + private Date lastUpdatedOn; + + @OneToOne( + mappedBy = "humanResource", + cascade = CascadeType.ALL, + orphanRemoval = true, + fetch = FetchType.LAZY + ) + private User user; + + @OneToMany( + mappedBy = "humanResource", + cascade = CascadeType.ALL, + fetch = FetchType.LAZY, + orphanRemoval = true + ) + private List humanResourceByOffices; + + @OneToMany( + fetch = FetchType.LAZY, + mappedBy = "humanResource", + orphanRemoval = true, + cascade = CascadeType.ALL + ) + private List humanResourceHasRoutes; + + @OneToMany( + fetch = FetchType.LAZY, + mappedBy = "humanResource", + orphanRemoval = true, + cascade = CascadeType.ALL + ) + private List advances; + + @Transient + private String fullName; + + public HumanResource() { + } + + public HumanResource(String id) { + this.id = id; + } + + /** + * + * @param id + * @param fullName + */ + public HumanResource(String id, String fullName) { + this.id = id; + this.fullName = fullName; + } + + /** + * + * @param id + * @param firstName + * @param lastName + * @param avatar + */ + public HumanResource(String id, String firstName, String lastName, String avatar) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + this.avatar = avatar; + } + + /** + * + * @param firstName + * @param lastName + * @param avatar + */ + public HumanResource(String firstName, String lastName, String avatar) { + this.firstName = firstName; + this.lastName = lastName; + this.avatar = avatar; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getSecondName() { + return secondName; + } + + public void setSecondName(String secondName) { + this.secondName = secondName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getMiddleName() { + return middleName; + } + + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + public Date getBirthdate() { + return birthdate; + } + + public void setBirthdate(Date birthdate) { + this.birthdate = birthdate; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getCurp() { + return curp; + } + + public void setCurp(String curp) { + this.curp = curp; + } + + public String getRfc() { + return rfc; + } + + public void setRfc(String rfc) { + this.rfc = rfc; + } + + public String getIfe() { + return ife; + } + + public void setIfe(String ife) { + this.ife = ife; + } + + public Date getAdmissionDate() { + return admissionDate; + } + + public void setAdmissionDate(Date admissionDate) { + this.admissionDate = admissionDate; + } + + public HumanResourceStatus getHumanResourceStatus() { + return humanResourceStatus; + } + + public void setHumanResourceStatus(HumanResourceStatus humanResourceStatus) { + this.humanResourceStatus = humanResourceStatus; + } + + public RoleCtlg getRoleCtlg() { + return roleCtlg; + } + + public void setRoleCtlg(RoleCtlg roleCtlg) { + this.roleCtlg = roleCtlg; + } + + public Bonus getBonus() { + return bonus; + } + + public void setBonus(Bonus bonus) { + this.bonus = bonus; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + + public BigDecimal getEmployeeSaving() { + return employeeSaving; + } + + public void setEmployeeSaving(BigDecimal employeeSaving) { + this.employeeSaving = employeeSaving; + } + + public BigDecimal getPayment() { + return payment; + } + + public void setPayment(BigDecimal payment) { + this.payment = payment; + } + + public BigDecimal getImss() { + return imss; + } + + public void setImss(BigDecimal imss) { + this.imss = imss; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedOn() { + return createdOn; + } + + public void setCreatedOn(Date createdOn) { + this.createdOn = createdOn; + } + + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public Date getLastUpdatedOn() { + return lastUpdatedOn; + } + + public void setLastUpdatedOn(Date lastUpdatedOn) { + this.lastUpdatedOn = lastUpdatedOn; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public List getHumanResourceByOffices() { + return humanResourceByOffices; + } + + public void setHumanResourceByOffices(List humanResourceByOffices) { + this.humanResourceByOffices = humanResourceByOffices; + } + + public List getHumanResourceHasRoutes() { + return humanResourceHasRoutes; + } + + public void setHumanResourceHasRoutes(List humanResourceHasRoutes) { + this.humanResourceHasRoutes = humanResourceHasRoutes; + } + + public List getAdvances() { + return advances; + } + + public void setAdvances(List advances) { + this.advances = advances; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + @Override + public String toString() { + return "HumanResource{" + "firstName=" + firstName + ", secondName=" + secondName + ", lastName=" + lastName + ", middleName=" + middleName + '}'; + } } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/ClosingDayBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/ClosingDayBean.java index cfbc243..28c7a6d 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/ClosingDayBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/ClosingDayBean.java @@ -305,7 +305,7 @@ public class ClosingDayBean extends GenericBean implements Serializable, Datatab cellGen.setColspan(1); tableGen.addCell(cellGen); - cellGen = new PdfPCell(new Paragraph("Entrega de préstamos: ", + cellGen = new PdfPCell(new Paragraph("Entrega de compras de producto: ", FontFactory.getFont("arial", 8, Font.BOLD, BaseColor.BLACK))); cellGen.setHorizontalAlignment(Element.ALIGN_LEFT); cellGen.setBorder(0); @@ -630,7 +630,7 @@ public class ClosingDayBean extends GenericBean implements Serializable, Datatab cellGen.setColspan(1); tableGen.addCell(cellGen); - cellGen = new PdfPCell(new Paragraph("Entrega de préstamos: ", + cellGen = new PdfPCell(new Paragraph("Entrega de compras de producto: ", FontFactory.getFont("arial", 8, Font.BOLD, BaseColor.BLACK))); cellGen.setHorizontalAlignment(Element.ALIGN_LEFT); cellGen.setBorder(0); @@ -882,7 +882,7 @@ public class ClosingDayBean extends GenericBean implements Serializable, Datatab if (!(dayOfWeek == Calendar.SUNDAY) && !(userId.equalsIgnoreCase("aad0c673-eb93-11ea-b7e1-02907d0fb4e6"))) { if (totalCustomerWithOutAction.compareTo(new Long(0)) == 1) { - FacesMessage msg = new FacesMessage("ERROR", "El asesor debe de realizar una acción en todos sus préstamos."); + FacesMessage msg = new FacesMessage("ERROR", "El asesor debe de realizar una acción en todas sus compras de producto."); FacesContext.getCurrentInstance().addMessage(null, msg); return; } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanEmployeeListBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanEmployeeListBean.java index 2a8f406..337f7c3 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanEmployeeListBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanEmployeeListBean.java @@ -9,15 +9,14 @@ import com.arrebol.apc.controller.BitacoraController; import com.arrebol.apc.controller.GenericController; import com.arrebol.apc.controller.GenericValidationController; import com.arrebol.apc.controller.admin.LoanEmployeeController; -import com.arrebol.apc.model.admin.ExpenseCompany; import com.arrebol.apc.model.admin.LoanEmployee; import com.arrebol.apc.model.admin.LoanEmployeeDetails; import com.arrebol.apc.model.core.HumanResource; import com.arrebol.apc.model.core.Office; -import com.arrebol.apc.model.views.LoanEmployeeView; import com.arrebol.apc.model.enums.ActiveStatus; import com.arrebol.apc.model.system.logs.Bitacora; import com.arrebol.apc.model.views.LoanEmployeeDetailAllDataView; +import com.arrebol.apc.model.views.LoanEmployeeView; import com.arrebol.apc.web.beans.Datatable; import com.arrebol.apc.web.beans.GenericBean; import java.io.Serializable; @@ -40,372 +39,369 @@ import org.primefaces.event.RowEditEvent; @ViewScoped public class LoanEmployeeListBean extends GenericBean implements Serializable, Datatable { - public List getDetails(String idLoan) { - try { - setLoanEmployeeDetails(getController().getLoanEmployeeDetailByIdLoan(idLoan)); + public List getDetails(String idLoan) { + try { + setLoanEmployeeDetails(getController().getLoanEmployeeDetailByIdLoan(idLoan)); + setTotalAmountLoan(fillTotalAmountLoan()); + } catch (Exception e) { + } + return null == loanEmployeeDetails ? new ArrayList<>() : loanEmployeeDetails; + } + + public void searchHistoricalAction() { + try { + if (getStarDate().after(getEndDate())) { + showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); + } else { + setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); + } + } catch (Exception e) { + } + } + + public BigDecimal searchTotalAmountLoan() { + try { + if (getStarDate().after(getEndDate())) { + showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); + } else { setTotalAmountLoan(fillTotalAmountLoan()); - } catch (Exception e) { - } - return null == loanEmployeeDetails ? new ArrayList<>() : loanEmployeeDetails; - } + } + } catch (Exception e) { + } + return getTotalAmountLoan(); + } - public void searchHistoricalAction() { - try { - if (getStarDate().after(getEndDate())) { - showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); - } else { - setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); - } - } catch (Exception e) { - } - } - - public BigDecimal searchTotalAmountLoan() { - try { - if (getStarDate().after(getEndDate())) { - showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); - } else { - setTotalAmountLoan(fillTotalAmountLoan()); - } - } catch (Exception e) { - } - return getTotalAmountLoan(); - } + public BigDecimal fillTotalAmountLoan() { + return getController().fillTotalAmountLoan(getStarDate(), getEndDate()); + } - public BigDecimal fillTotalAmountLoan() { - return getController().fillTotalAmountLoan(getStarDate(), getEndDate()); - } - - @Override - public void editRow(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void editRow(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowCancel(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void onRowCancel(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowReorder(ReorderEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void onRowReorder(ReorderEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void addRow() { - Date date = new Date(); - if (genericCtrl.existStableGeneralBoxByCreatedOn(date)) { - showMessage(FacesMessage.SEVERITY_WARN, "Día cerrado", "No se pueden agregar más préstamos a empleados porque ya se existe un cuadre de caja general de hoy."); - return; - } - - if(amountLoan.compareTo(BigDecimal.ZERO)==0 || amountToPay.compareTo(BigDecimal.ZERO)==0 ){ - - showMessage(FacesMessage.SEVERITY_WARN, "Prestamo Incorrecto", "No se pueden agregar préstamos a empleados con monto o monto de abonos de 0"); - return; - - } - - if(amountLoan.compareTo(amountToPay)<=0){ - - showMessage(FacesMessage.SEVERITY_WARN, "Prestamo Incorrecto", "No se pueden agregar préstamos a empleados con valor a pagar menor a sus abonos"); - return; - - } - - LoanEmployee loan = new LoanEmployee(); - loan.setIdEmployee(userId); - loan.setCreatedOn(new Date()); - loan.setCreatedBy(getLoggedUser().getUser().getId()); - loan.setAmountLoan(amountLoan); - loan.setAmountToPay(amountToPay); - loan.setLoanEmployeeStatus(ActiveStatus.ENEBLED); - - // Calcula numero de semanas - Double interes = 0.05; - Double interesReal = 0.0; - Double semanasD = amountLoan.doubleValue()/amountToPay.doubleValue(); - int numSemanas = semanasD.intValue(); - double residuo = semanasD - numSemanas; - if(residuo != 0.0){ - numSemanas += 1; - } - - // Calcula número de meses - int numMeses = numSemanas/4; - if(numSemanas % 4 > 0){ - numMeses += 1; - } - - // Calcula el interes real 0.05 por el número de meses - interesReal = interes * numMeses; - Double saldoTotal = (amountLoan.doubleValue() * interesReal) + amountLoan.doubleValue(); - loan.setTotalAmountToPay(new BigDecimal(saldoTotal)); - loan.setBalance(new BigDecimal(saldoTotal)); - - HumanResource hr = users.stream().filter(p -> p.getId().equals(userId)).findFirst().get(); - hr.setBalance(hr.getBalance().add(new BigDecimal(saldoTotal))); - - getController().saveLoanEmployee(loan, hr); - - userId = ""; - amountLoan = BigDecimal.ZERO; - amountToPay = BigDecimal.ZERO; - - setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); - } + @Override + public void addRow() { + Date date = new Date(); + if (genericCtrl.existStableGeneralBoxByCreatedOn(date)) { + showMessage(FacesMessage.SEVERITY_WARN, "Día cerrado", "No se pueden agregar más compras de producto a empleados porque ya se existe un cuadre de caja general de hoy."); + return; + } - public void addRowLoanDetail() { - - if(loanDetailAmount.compareTo(BigDecimal.ZERO)==0){ - - showMessage(FacesMessage.SEVERITY_WARN, "Abono Incorrecto", "No se pueden agregar un abono de 0"); - return; - - } - - if(loanDetailAmount.compareTo(BigDecimal.ZERO)<0){ - - showMessage(FacesMessage.SEVERITY_WARN, "Abono Incorrecto", "No se pueden agregar un abono negativo"); - return; - - } - - if (genericCtrl.existStableGeneralBoxByCreatedOn(new Date())) { - showMessage(FacesMessage.SEVERITY_WARN, "Día cerrado", "No se pueden hacer mas abonos a prestamos porque ya se existe un cuadre de caja general de hoy."); - return; - } - - - if(loanDetailAmount.compareTo(selectedLoan.getBalance())<=0){ - if(selectedLoan.getLoanEmployeeStatus()== ActiveStatus.ENEBLED){ - LoanEmployeeDetails loanDetail = new LoanEmployeeDetails(); - loanDetail.setIdLoan(selectedLoan.getId()); - loanDetail.setIdUser(selectedLoan.getIdUser()); - loanDetail.setPaymentAmount(loanDetailAmount); - loanDetail.setReferenceNumber(selectedLoan.getReferenceNumber() + 1); - loanDetail.setCreatedOn(new Date()); - loanDetail.setCreatedBy(getLoggedUser().getUser().getId()); - loanDetail.setLoanEmployeeDetailStatus(ActiveStatus.ENEBLED); - loanDetail.setPayroll(ActiveStatus.DISABLED); - - HumanResource hr = users.stream().filter(p -> p.getId().equals(selectedLoan.getIdUser())).findFirst().get(); - hr.setBalance(hr.getBalance().subtract(loanDetailAmount)); + if (amountLoan.compareTo(BigDecimal.ZERO) == 0 || amountToPay.compareTo(BigDecimal.ZERO) == 0) { - LoanEmployee loan = getController().getLoanEmployeeById(selectedLoan.getId()); - loan.setBalance(loan.getBalance().subtract(loanDetailAmount)); - - getController().saveLoanEmployeeDetail(loanDetail, hr, loan); - loanDetailAmount = BigDecimal.ZERO; - - setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); - showMessage(FacesMessage.SEVERITY_INFO, "Abono correcto", "Abono creado correctamente.");} - else{ - showMessage(FacesMessage.SEVERITY_WARN, "Prestamo deshabilitado", "No se puede abonar a un préstamo deshabilitado"); - } - }else{ - showMessage(FacesMessage.SEVERITY_WARN, "Cantidad incorrecta", "La cantidad a abonar es mayor a la deuda faltante del préstamo"); - } - - } + showMessage(FacesMessage.SEVERITY_WARN, "Compra de producto incorrecto", "No se pueden agregar la compra de producto a empleados con monto o monto de abonos de 0"); + return; - @Override - public void deleteRow() { - - if (genericCtrl.existStableGeneralBoxByCreatedOn(selectedLoan.getCreatedOn())) { - showMessage(FacesMessage.SEVERITY_WARN, "Préstamo a empleado", "No se puede borrar porque ya se realizó el cuadre de caja general del día."); - } else { - if(selectedLoan.getTotalAmountToPay().compareTo(selectedLoan.getBalance())==0){ - boolean delete = true; + } + + if (amountLoan.compareTo(amountToPay) <= 0) { + + showMessage(FacesMessage.SEVERITY_WARN, "Compra de producto incorrecto", "No se pueden agregar la compra de producto a empleados con valor a pagar menor a sus abonos"); + return; + + } + + LoanEmployee loan = new LoanEmployee(); + loan.setIdEmployee(userId); + loan.setCreatedOn(new Date()); + loan.setCreatedBy(getLoggedUser().getUser().getId()); + loan.setAmountLoan(amountLoan); + loan.setAmountToPay(amountToPay); + loan.setLoanEmployeeStatus(ActiveStatus.ENEBLED); + + // Calcula numero de semanas + Double interes = 0.05; + Double interesReal = 0.0; + Double semanasD = amountLoan.doubleValue() / amountToPay.doubleValue(); + int numSemanas = semanasD.intValue(); + double residuo = semanasD - numSemanas; + if (residuo != 0.0) { + numSemanas += 1; + } + + // Calcula número de meses + int numMeses = numSemanas / 4; + if (numSemanas % 4 > 0) { + numMeses += 1; + } + + // Calcula el interes real 0.05 por el número de meses + interesReal = interes * numMeses; + Double saldoTotal = (amountLoan.doubleValue() * interesReal) + amountLoan.doubleValue(); + loan.setTotalAmountToPay(new BigDecimal(saldoTotal)); + loan.setBalance(new BigDecimal(saldoTotal)); + + HumanResource hr = users.stream().filter(p -> p.getId().equals(userId)).findFirst().get(); + hr.setBalance(hr.getBalance().add(new BigDecimal(saldoTotal))); + + getController().saveLoanEmployee(loan, hr); + + userId = ""; + amountLoan = BigDecimal.ZERO; + amountToPay = BigDecimal.ZERO; + + setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); + } + + public void addRowLoanDetail() { + + if (loanDetailAmount.compareTo(BigDecimal.ZERO) == 0) { + + showMessage(FacesMessage.SEVERITY_WARN, "Abono Incorrecto", "No se pueden agregar un abono de 0"); + return; + + } + + if (loanDetailAmount.compareTo(BigDecimal.ZERO) < 0) { + + showMessage(FacesMessage.SEVERITY_WARN, "Abono Incorrecto", "No se pueden agregar un abono negativo"); + return; + + } + + if (genericCtrl.existStableGeneralBoxByCreatedOn(new Date())) { + showMessage(FacesMessage.SEVERITY_WARN, "Día cerrado", "No se pueden hacer mas abonos a compra de productos porque ya se existe un cuadre de caja general de hoy."); + return; + } + + if (loanDetailAmount.compareTo(selectedLoan.getBalance()) <= 0) { + if (selectedLoan.getLoanEmployeeStatus() == ActiveStatus.ENEBLED) { + LoanEmployeeDetails loanDetail = new LoanEmployeeDetails(); + loanDetail.setIdLoan(selectedLoan.getId()); + loanDetail.setIdUser(selectedLoan.getIdUser()); + loanDetail.setPaymentAmount(loanDetailAmount); + loanDetail.setReferenceNumber(selectedLoan.getReferenceNumber() + 1); + loanDetail.setCreatedOn(new Date()); + loanDetail.setCreatedBy(getLoggedUser().getUser().getId()); + loanDetail.setLoanEmployeeDetailStatus(ActiveStatus.ENEBLED); + loanDetail.setPayroll(ActiveStatus.DISABLED); + + HumanResource hr = users.stream().filter(p -> p.getId().equals(selectedLoan.getIdUser())).findFirst().get(); + hr.setBalance(hr.getBalance().subtract(loanDetailAmount)); + + LoanEmployee loan = getController().getLoanEmployeeById(selectedLoan.getId()); + loan.setBalance(loan.getBalance().subtract(loanDetailAmount)); + + getController().saveLoanEmployeeDetail(loanDetail, hr, loan); + loanDetailAmount = BigDecimal.ZERO; + + setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); + showMessage(FacesMessage.SEVERITY_INFO, "Abono correcto", "Abono creado correctamente."); + } else { + showMessage(FacesMessage.SEVERITY_WARN, "Compra de producto deshabilitado", "No se puede abonar a una compra deshabilitado"); + } + } else { + showMessage(FacesMessage.SEVERITY_WARN, "Cantidad incorrecta", "La cantidad a abonar es mayor a la deuda faltante de la compra de producto"); + } + + } + + @Override + public void deleteRow() { + + if (genericCtrl.existStableGeneralBoxByCreatedOn(selectedLoan.getCreatedOn())) { + showMessage(FacesMessage.SEVERITY_WARN, "Compra de producto a empleado", "No se puede borrar porque ya se realizó el cuadre de caja general del día."); + } else { + if (selectedLoan.getTotalAmountToPay().compareTo(selectedLoan.getBalance()) == 0) { + boolean delete = true; delete = selectedLoan.getLoanEmployeeStatus() == ActiveStatus.ENEBLED ? true : false; if (delete) { - getController().updateLoanEmployeeByStatus(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); - setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); + getController().updateLoanEmployeeByStatus(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); - Bitacora bitacora = new Bitacora(); - LoanEmployee loan = getController().getLoanEmployeeById(selectedLoan.getId()); - bitacora.setAction("Eliminar gasto administrativo"); - bitacora.setCommentsUser(commentsBitacora); - bitacora.setCreatedBy(getLoggedUser().getUser().getId()); - bitacora.setCreatedOn(new Date()); - bitacora.setNameUser(getLoggedUser().getUser().getUserName()); - bitacora.setOffice(new Office(getLoggedUser().getOffice().getId())); - bitacora.setDescription("Se eliminó el prestamo con monto $" - + loan.getAmountLoan()+ " y fecha " + loan.getCreatedOn()); + Bitacora bitacora = new Bitacora(); + LoanEmployee loan = getController().getLoanEmployeeById(selectedLoan.getId()); + bitacora.setAction("Eliminar gasto administrativo"); + bitacora.setCommentsUser(commentsBitacora); + bitacora.setCreatedBy(getLoggedUser().getUser().getId()); + bitacora.setCreatedOn(new Date()); + bitacora.setNameUser(getLoggedUser().getUser().getUserName()); + bitacora.setOffice(new Office(getLoggedUser().getOffice().getId())); + bitacora.setDescription("Se eliminó la compra de producto con monto $" + + loan.getAmountLoan() + " y fecha " + loan.getCreatedOn()); - /* + /* List details = getDetails(selectedLoan.getId()); if (details != null) { for (LoanEmployeeDetailAllDataView detail : details) { getController().updateLoanEmployeeDetailByStatus(ActiveStatus.DISABLED, detail.getId(), getLoggedUser().getUser().getId()); } }*/ - - bitacoraCtrl.saveBitacora(bitacora); - commentsBitacora = ""; - selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Préstamo a empleado eliminado", "Se eliminó correctamente."); + bitacoraCtrl.saveBitacora(bitacora); + commentsBitacora = ""; + selectedLoan = null; + showMessage(FacesMessage.SEVERITY_INFO, "Compra de producto a empleado eliminado", "Se eliminó correctamente."); } - } - else{ - showMessage(FacesMessage.SEVERITY_INFO, "Préstamo tiene abonos agregados", "No se puede borrar un préstamo con abonos."); - } - - } - } + } else { + showMessage(FacesMessage.SEVERITY_INFO, "La compra de producto tiene abonos agregados", "No se puede borrar una compra de producto con abonos."); + } - private LoanEmployeeController controller; - private GenericController genericCtrl; - private List loanEmployeeView; - private List loanEmployeeDetails; - private LoanEmployeeView selectedLoan; - private List users; - private String userId; - private BigDecimal amountLoan; - private BigDecimal amountToPay; - private BigDecimal loanDetailAmount; - private BigDecimal totalAmountLoan; - - private BitacoraController bitacoraCtrl; - private GenericValidationController genericValidateController; - private Date lastStableGeneralBox; - private String commentsBitacora; + } + } - public BigDecimal getTotalAmountLoan() { - return totalAmountLoan; - } + private LoanEmployeeController controller; + private GenericController genericCtrl; + private List loanEmployeeView; + private List loanEmployeeDetails; + private LoanEmployeeView selectedLoan; + private List users; + private String userId; + private BigDecimal amountLoan; + private BigDecimal amountToPay; + private BigDecimal loanDetailAmount; + private BigDecimal totalAmountLoan; - public void setTotalAmountLoan(BigDecimal totalAmountLoan) { - this.totalAmountLoan = totalAmountLoan; - } + private BitacoraController bitacoraCtrl; + private GenericValidationController genericValidateController; + private Date lastStableGeneralBox; + private String commentsBitacora; - public BigDecimal getAmountLoan() { - return amountLoan; - } + public BigDecimal getTotalAmountLoan() { + return totalAmountLoan; + } - public void setAmountLoan(BigDecimal amountLoan) { - this.amountLoan = amountLoan; - } + public void setTotalAmountLoan(BigDecimal totalAmountLoan) { + this.totalAmountLoan = totalAmountLoan; + } - public BigDecimal getLoanDetailAmount() { - return loanDetailAmount; - } + public BigDecimal getAmountLoan() { + return amountLoan; + } - public void setLoanDetailAmount(BigDecimal loanDetailAmount) { - this.loanDetailAmount = loanDetailAmount; - } + public void setAmountLoan(BigDecimal amountLoan) { + this.amountLoan = amountLoan; + } - public BigDecimal getAmountToPay() { - return amountToPay; - } + public BigDecimal getLoanDetailAmount() { + return loanDetailAmount; + } - public void setAmountToPay(BigDecimal amountToPay) { - this.amountToPay = amountToPay; - } - - public String getUserId() { - return userId; - } + public void setLoanDetailAmount(BigDecimal loanDetailAmount) { + this.loanDetailAmount = loanDetailAmount; + } - public void setUserId(String userId) { - this.userId = userId; - } + public BigDecimal getAmountToPay() { + return amountToPay; + } - public GenericController getGenericCtrl() { - return genericCtrl; - } + public void setAmountToPay(BigDecimal amountToPay) { + this.amountToPay = amountToPay; + } - public void setGenericCtrl(GenericController genericCtrl) { - this.genericCtrl = genericCtrl; - } + public String getUserId() { + return userId; + } - public List getUsers() { - return users; - } + public void setUserId(String userId) { + this.userId = userId; + } - public void setUsers(List users) { - this.users = users; - } + public GenericController getGenericCtrl() { + return genericCtrl; + } - public List getLoanEmployeeView() { - return loanEmployeeView; - } + public void setGenericCtrl(GenericController genericCtrl) { + this.genericCtrl = genericCtrl; + } - public void setLoanEmployeeView(List loanEmployeeView) { - this.loanEmployeeView = loanEmployeeView; - } + public List getUsers() { + return users; + } - public LoanEmployeeView getSelectedLoan() { - return selectedLoan; - } + public void setUsers(List users) { + this.users = users; + } - public void setSelectedLoan(LoanEmployeeView selectedLoan) { - this.selectedLoan = selectedLoan; - } + public List getLoanEmployeeView() { + return loanEmployeeView; + } - public LoanEmployeeController getController() { - return controller; - } + public void setLoanEmployeeView(List loanEmployeeView) { + this.loanEmployeeView = loanEmployeeView; + } - public void setController(LoanEmployeeController controller) { - this.controller = controller; - } + public LoanEmployeeView getSelectedLoan() { + return selectedLoan; + } - public List getLoanEmployee() { - return loanEmployeeView; - } + public void setSelectedLoan(LoanEmployeeView selectedLoan) { + this.selectedLoan = selectedLoan; + } - public void setLoanEmployee(List loanEmployee) { - this.loanEmployeeView = loanEmployee; - } + public LoanEmployeeController getController() { + return controller; + } - public List getLoanEmployeeDetails() { - return loanEmployeeDetails; - } + public void setController(LoanEmployeeController controller) { + this.controller = controller; + } - public void setLoanEmployeeDetails(List loanEmployeeDetails) { - this.loanEmployeeDetails = loanEmployeeDetails; - } + public List getLoanEmployee() { + return loanEmployeeView; + } - public String getCommentsBitacora() { - return commentsBitacora; - } + public void setLoanEmployee(List loanEmployee) { + this.loanEmployeeView = loanEmployee; + } - public void setCommentsBitacora(String commentsBitacora) { - this.commentsBitacora = commentsBitacora; - } + public List getLoanEmployeeDetails() { + return loanEmployeeDetails; + } - public GenericValidationController getGenericValidateController() { - return genericValidateController; - } - - public void setGenericValidateController(GenericValidationController genericController) { - this.genericValidateController = genericController; - } - - public Date getLastStableGeneralBox() { - return lastStableGeneralBox; - } + public void setLoanEmployeeDetails(List loanEmployeeDetails) { + this.loanEmployeeDetails = loanEmployeeDetails; + } - public void setLastStableGeneralBox(Date lastStableGeneralBox) { - this.lastStableGeneralBox = lastStableGeneralBox; - } - - @PostConstruct - public void init() { - try { - loadBundlePropertyFile(); - genericCtrl = new GenericController(); - setController(new LoanEmployeeController()); - bitacoraCtrl = new BitacoraController(); - setGenericValidateController(new GenericValidationController()); - setLastStableGeneralBox(getGenericValidateController().lastStableGeneralBoxByDate(getLoggedUser().getUser())); - setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); - // users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); - users = genericCtrl.getAllHRByOffice(getLoggedUser().getOffice().getId()); - totalAmountLoan = fillTotalAmountLoan(); - } catch (Exception e) { - } - } + public String getCommentsBitacora() { + return commentsBitacora; + } + + public void setCommentsBitacora(String commentsBitacora) { + this.commentsBitacora = commentsBitacora; + } + + public GenericValidationController getGenericValidateController() { + return genericValidateController; + } + + public void setGenericValidateController(GenericValidationController genericController) { + this.genericValidateController = genericController; + } + + public Date getLastStableGeneralBox() { + return lastStableGeneralBox; + } + + public void setLastStableGeneralBox(Date lastStableGeneralBox) { + this.lastStableGeneralBox = lastStableGeneralBox; + } + + @PostConstruct + public void init() { + try { + loadBundlePropertyFile(); + genericCtrl = new GenericController(); + setController(new LoanEmployeeController()); + bitacoraCtrl = new BitacoraController(); + setGenericValidateController(new GenericValidationController()); + setLastStableGeneralBox(getGenericValidateController().lastStableGeneralBoxByDate(getLoggedUser().getUser())); + setLoanEmployee(getController().fillLoanEmployeeDataTable(getStarDate(), getEndDate())); + // users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); + users = genericCtrl.getAllHRByOffice(getLoggedUser().getOffice().getId()); + totalAmountLoan = fillTotalAmountLoan(); + } catch (Exception e) { + } + } } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryBean.java index 574408d..a2fe5b5 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryBean.java @@ -1,8 +1,8 @@ /* * Arrebol Consultancy copyright. - * + * * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.web.beans.admin; @@ -41,43 +41,43 @@ import org.primefaces.event.RowEditEvent; @ViewScoped public class LoanHistoryBean extends GenericBean implements Serializable, Datatable { - public void searchHistoricalAction() { - try { - if (getStarDate().after(getEndDate())) { - showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); - } else { - setLoan(getLoanCtrl().fillAllLoansViewDatatable(getStarDate(), getEndDate())); - } - } catch (Exception e) { - } - } + public void searchHistoricalAction() { + try { + if (getStarDate().after(getEndDate())) { + showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); + } else { + setLoan(getLoanCtrl().fillAllLoansViewDatatable(getStarDate(), getEndDate())); + } + } catch (Exception e) { + } + } - public List fillDatatableLoan() { - return getLoanCtrl().fillAllLoansViewDatatable(getStarDate(), getEndDate()); - } + public List fillDatatableLoan() { + return getLoanCtrl().fillAllLoansViewDatatable(getStarDate(), getEndDate()); + } - public void changeBonusNewCustomer() { - loanCtrl.updateBonusNewCustomer(ActiveStatus.ENEBLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); - loan.clear(); - loan = fillDatatableLoan(); - selectedLoan = null; + public void changeBonusNewCustomer() { + loanCtrl.updateBonusNewCustomer(ActiveStatus.ENEBLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + loan.clear(); + loan = fillDatatableLoan(); + selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "El préstamo empezó a contar como bono de cliente nuevo."); - } + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "La compra de producto empezó a contar como bono de cliente nuevo."); + } - public void removeBonusNewCustomer() { - loanCtrl.updateBonusNewCustomer(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); - loan.clear(); - loan = fillDatatableLoan(); - selectedLoan = null; + public void removeBonusNewCustomer() { + loanCtrl.updateBonusNewCustomer(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + loan.clear(); + loan = fillDatatableLoan(); + selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "El préstamo ya no contará como bono de cliente nuevo."); - } + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "La compra de producto ya no contará como bono de cliente nuevo."); + } - public void deleteFeeLoan() { + public void deleteFeeLoan() { + + /* if (selectedLoan.getEstatusPrestamo()== LoanStatus.APPROVED.getValue() || selectedLoan.getEstatusPrestamo() == LoanStatus.PENDING_RENOVATION.getValue()) { - /* if (selectedLoan.getEstatusPrestamo()== LoanStatus.APPROVED.getValue() || selectedLoan.getEstatusPrestamo() == LoanStatus.PENDING_RENOVATION.getValue()) { - List details = loanCtrl.getLoanDetailsFeeCurdatebyIdLoan(selectedLoan.getId()); if (details != null && !details.isEmpty()) { Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); @@ -99,74 +99,74 @@ public class LoanHistoryBean extends GenericBean implements Serializable, Datata else { showMessage(FacesMessage.SEVERITY_WARN, "No se puede eliminar la multa", "Solo puedes eliminar la multa de préstamos en estatus Aprobados o Pendiente por renovación"); - return; - }*/ - } - - public void changeRoute() { - if (!routeId.isEmpty()) { - if (loanCtrl.updateRouteById(new RouteCtlg(routeId), selectedLoan.getId(), getLoggedUser().getUser().getId())) { - showMessage(FacesMessage.SEVERITY_INFO, "Ruta modificada", "Se modificó correctamente."); - } else { - showMessage(FacesMessage.SEVERITY_WARN, "Ruta modificada", "Ocurrió un error durante el proceso."); - } - - } - } - - public void changeLoanType() { - if (selectedLoan.getEstatusPrestamo() != LoanStatus.TO_DELIVERY.getValue()) { - loanTypeId = ""; - selectedLoan = null; - showMessage(FacesMessage.SEVERITY_WARN, "No se puede cambiar el tipo de préstamo", "Solo puedes cambiar el monto a prestar de préstamos en estatus Por liberar"); return; - } - Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); - loanUpdate.setLoanType(new LoanType(loanTypeId)); - loanUpdate.setAmountToPay(loanTypeCtrl.getLoanTypeById(loanTypeId).getPaymentTotal()); - if (loanCtrl.updateLoan(loanUpdate)) { - loan.clear(); - loan = fillDatatableLoan(); - loanTypeId = ""; - selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de préstamo", "El préstamo se cambió correctamente"); - } + }*/ + } - } + public void changeRoute() { + if (!routeId.isEmpty()) { + if (loanCtrl.updateRouteById(new RouteCtlg(routeId), selectedLoan.getId(), getLoggedUser().getUser().getId())) { + showMessage(FacesMessage.SEVERITY_INFO, "Ruta modificada", "Se modificó correctamente."); + } else { + showMessage(FacesMessage.SEVERITY_WARN, "Ruta modificada", "Ocurrió un error durante el proceso."); + } - public void deleteLoan() { - /* loanCtrl.updateLoanByStatusWeb(LoanStatus.DELETED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + } + } + + public void changeLoanType() { + if (selectedLoan.getEstatusPrestamo() != LoanStatus.TO_DELIVERY.getValue()) { + loanTypeId = ""; + selectedLoan = null; + showMessage(FacesMessage.SEVERITY_WARN, "No se puede cambiar el tipo de compra de producto", "Solo puedes cambiar el monto a comprar de compra de producto en estatus Por liberar"); + return; + } + Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); + loanUpdate.setLoanType(new LoanType(loanTypeId)); + loanUpdate.setAmountToPay(loanTypeCtrl.getLoanTypeById(loanTypeId).getPaymentTotal()); + if (loanCtrl.updateLoan(loanUpdate)) { + loan.clear(); + loan = fillDatatableLoan(); + loanTypeId = ""; + selectedLoan = null; + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de compra de producto", "La compra de producto se cambió correctamente"); + } + + } + + public void deleteLoan() { + /* loanCtrl.updateLoanByStatusWeb(LoanStatus.DELETED, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.DELETED, selectedLoan); loan.remove(selectedLoan); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Eliminado' de forma correcta.");*/ - } + } - public void changeApprovedStatus() { - /*loanCtrl.updateLoanByStatusWeb(LoanStatus.APPROVED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + public void changeApprovedStatus() { + /*loanCtrl.updateLoanByStatusWeb(LoanStatus.APPROVED, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.APPROVED, selectedLoan); loan.clear(); loan = fillDatatableLoan(); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Aprobado' de forma correcta.");*/ - } + } - public void changeFinishStatus() { - /*loanCtrl.updateLoanByStatusWeb(LoanStatus.FINISH, selectedLoan.getId(), getLoggedUser().getUser().getId()); + public void changeFinishStatus() { + /*loanCtrl.updateLoanByStatusWeb(LoanStatus.FINISH, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.FINISH, selectedLoan); loan.clear(); loan = fillDatatableLoan(); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Aprobado' de forma correcta.");*/ - } + } - public void deletePaymentLoan() { + public void deletePaymentLoan() { + + /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { - /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { - List details = loanCtrl.getLoanDetailsCurdatebyIdLoan(selectedLoan.getId()); if (details != null && !details.isEmpty()) { Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); @@ -188,17 +188,17 @@ public class LoanHistoryBean extends GenericBean implements Serializable, Datata else { showMessage(FacesMessage.SEVERITY_WARN, "No se puede eliminar abono", "Solo puedes eliminar el abono de préstamos en estatus Aprobados o Pendiente por renovación"); - return; + return; }*/ - } + } - @Override - public void editRow(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void editRow(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - public void addPayment() { - /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { + public void addPayment() { + /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { LoanDetails detail = new LoanDetails(); detail.setComments(comments); detail.setCreatedBy(getLoggedUser().getUser().getId()); @@ -239,10 +239,10 @@ public class LoanHistoryBean extends GenericBean implements Serializable, Datata return; }*/ - } + } - public void addFee() { - /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { + public void addFee() { + /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { selectedLoan = null; userId = ""; comments = ""; @@ -282,10 +282,10 @@ public class LoanHistoryBean extends GenericBean implements Serializable, Datata fee = BigDecimal.ZERO; showMessage(FacesMessage.SEVERITY_INFO, "Agregar multa", "Se agregó la multa de forma correcta."); }*/ - } + } - public void changeOwner() { - /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { + public void changeOwner() { + /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { selectedLoan = null; userId = ""; showMessage(FacesMessage.SEVERITY_WARN, "No se puede modificar propietario", "Solo puedes cambiar de propietario a préstamos en estatus Aprobados"); @@ -319,228 +319,228 @@ public class LoanHistoryBean extends GenericBean implements Serializable, Datata selectedLoan = null; showMessage(FacesMessage.SEVERITY_ERROR, "Cambio de propietario", "Ocurrió un error al intentar hacer el cambio de propietario."); }*/ - } + } - /** - * - */ - private void initStartAndEndDates() { - try { - Calendar starDateCalendar = Calendar.getInstance(); + /** + * + */ + private void initStartAndEndDates() { + try { + Calendar starDateCalendar = Calendar.getInstance(); - starDateCalendar.setTime(DateWrapper.getTodayMXTime()); - starDateCalendar.add(Calendar.MONTH, -1); + starDateCalendar.setTime(DateWrapper.getTodayMXTime()); + starDateCalendar.add(Calendar.MONTH, -1); - setStarDate(starDateCalendar.getTime()); - setEndDate(DateWrapper.getTodayMXTime()); - } catch (Exception e) { + setStarDate(starDateCalendar.getTime()); + setEndDate(DateWrapper.getTodayMXTime()); + } catch (Exception e) { - } - } + } + } - public void approvedLoan() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + public void approvedLoan() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowCancel(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void onRowCancel(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowReorder(ReorderEvent event) { - showMessage(FacesMessage.SEVERITY_INFO, "Registro Movido", "De columna: " + (event.getFromIndex() + 1) + " a columna: " + (event.getToIndex() + 1)); - } + @Override + public void onRowReorder(ReorderEvent event) { + showMessage(FacesMessage.SEVERITY_INFO, "Registro Movido", "De columna: " + (event.getFromIndex() + 1) + " a columna: " + (event.getToIndex() + 1)); + } - @Override - public void addRow() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void addRow() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void deleteRow() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void deleteRow() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - /** - * - * @param outcome - * @return - */ - public String detailLoan(String outcome) { - return outcome; - } + /** + * + * @param outcome + * @return + */ + public String detailLoan(String outcome) { + return outcome; + } - public LoanController getLoanCtrl() { - return loanCtrl; - } + public LoanController getLoanCtrl() { + return loanCtrl; + } - public void setLoanCtrl(LoanController loanCtrl) { - this.loanCtrl = loanCtrl; - } + public void setLoanCtrl(LoanController loanCtrl) { + this.loanCtrl = loanCtrl; + } - public List getLoan() { - return loan; - } + public List getLoan() { + return loan; + } - public void setLoan(List loan) { - this.loan = loan; - } + public void setLoan(List loan) { + this.loan = loan; + } - public HistoryLoanView getSelectedLoan() { - return selectedLoan; - } + public HistoryLoanView getSelectedLoan() { + return selectedLoan; + } - public void setSelectedLoan(HistoryLoanView selectedLoan) { - this.selectedLoan = selectedLoan; - } + public void setSelectedLoan(HistoryLoanView selectedLoan) { + this.selectedLoan = selectedLoan; + } - public String getComments() { - return comments; - } + public String getComments() { + return comments; + } - public void setComments(String comments) { - this.comments = comments; - } + public void setComments(String comments) { + this.comments = comments; + } - public GenericController getGenericCtrl() { - return genericCtrl; - } + public GenericController getGenericCtrl() { + return genericCtrl; + } - public void setGenericCtrl(GenericController genericCtrl) { - this.genericCtrl = genericCtrl; - } + public void setGenericCtrl(GenericController genericCtrl) { + this.genericCtrl = genericCtrl; + } - public List getUsers() { - return users; - } + public List getUsers() { + return users; + } - public void setUsers(List users) { - this.users = users; - } + public void setUsers(List users) { + this.users = users; + } - public String getUserId() { - return userId; - } + public String getUserId() { + return userId; + } - public void setUserId(String userId) { - this.userId = userId; - } + public void setUserId(String userId) { + this.userId = userId; + } - public BigDecimal getPayment() { - return payment; - } + public BigDecimal getPayment() { + return payment; + } - public void setPayment(BigDecimal payment) { - this.payment = payment; - } + public void setPayment(BigDecimal payment) { + this.payment = payment; + } - public BigDecimal getFee() { - return fee; - } + public BigDecimal getFee() { + return fee; + } - public void setFee(BigDecimal fee) { - this.fee = fee; - } + public void setFee(BigDecimal fee) { + this.fee = fee; + } - public LoanTypeController getLoanTypeCtrl() { - return loanTypeCtrl; - } + public LoanTypeController getLoanTypeCtrl() { + return loanTypeCtrl; + } - public void setLoanTypeCtrl(LoanTypeController loanTypeCtrl) { - this.loanTypeCtrl = loanTypeCtrl; - } + public void setLoanTypeCtrl(LoanTypeController loanTypeCtrl) { + this.loanTypeCtrl = loanTypeCtrl; + } - public List getLoanType() { - return loanType; - } + public List getLoanType() { + return loanType; + } - public void setLoanType(List loanType) { - this.loanType = loanType; - } + public void setLoanType(List loanType) { + this.loanType = loanType; + } - public String getLoanTypeId() { - return loanTypeId; - } + public String getLoanTypeId() { + return loanTypeId; + } - public void setLoanTypeId(String loanTypeId) { - this.loanTypeId = loanTypeId; - } + public void setLoanTypeId(String loanTypeId) { + this.loanTypeId = loanTypeId; + } - public String getRouteId() { - return routeId; - } + public String getRouteId() { + return routeId; + } - public void setRouteId(String routeId) { - this.routeId = routeId; - } + public void setRouteId(String routeId) { + this.routeId = routeId; + } - public RouteController getRouteCtrl() { - return routeCtrl; - } + public RouteController getRouteCtrl() { + return routeCtrl; + } - public void setRouteCtrl(RouteController routeCtrl) { - this.routeCtrl = routeCtrl; - } + public void setRouteCtrl(RouteController routeCtrl) { + this.routeCtrl = routeCtrl; + } - public List getRoute() { - return route; - } + public List getRoute() { + return route; + } - public void setRoute(List route) { - this.route = route; - } + public void setRoute(List route) { + this.route = route; + } - public Date getStarDate() { - return starDate; - } + public Date getStarDate() { + return starDate; + } - public void setStarDate(Date starDate) { - this.starDate = starDate; - } + public void setStarDate(Date starDate) { + this.starDate = starDate; + } - public Date getEndDate() { - return endDate; - } + public Date getEndDate() { + return endDate; + } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } + public void setEndDate(Date endDate) { + this.endDate = endDate; + } - private LoanController loanCtrl; - private LoanTypeController loanTypeCtrl; - private GenericController genericCtrl; - private RouteController routeCtrl; + private LoanController loanCtrl; + private LoanTypeController loanTypeCtrl; + private GenericController genericCtrl; + private RouteController routeCtrl; - private List loan; - private List users; - private List loanType; - private List route; - private HistoryLoanView selectedLoan; - private String comments; - private String userId; - private BigDecimal payment; - private BigDecimal fee; - private String loanTypeId; - private String routeId; + private List loan; + private List users; + private List loanType; + private List route; + private HistoryLoanView selectedLoan; + private String comments; + private String userId; + private BigDecimal payment; + private BigDecimal fee; + private String loanTypeId; + private String routeId; - private Date starDate; - private Date endDate; + private Date starDate; + private Date endDate; - @PostConstruct - public void init() { - loadBundlePropertyFile(); - - loanCtrl = new LoanController(); - genericCtrl = new GenericController(); - loanTypeCtrl = new LoanTypeController(); - routeCtrl = new RouteController(); - initStartAndEndDates(); - users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); - loanType = loanTypeCtrl.fillLoanTypeDatatable(getLoggedUser().getOffice().getId()); - route = routeCtrl.fillRoutesDatatable(getLoggedUser().getOffice().getId()); + @PostConstruct + public void init() { + loadBundlePropertyFile(); - setLoan(fillDatatableLoan()); - } + loanCtrl = new LoanController(); + genericCtrl = new GenericController(); + loanTypeCtrl = new LoanTypeController(); + routeCtrl = new RouteController(); + initStartAndEndDates(); + users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); + loanType = loanTypeCtrl.fillLoanTypeDatatable(getLoggedUser().getOffice().getId()); + route = routeCtrl.fillRoutesDatatable(getLoggedUser().getOffice().getId()); + + setLoan(fillDatatableLoan()); + } } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryJuridicalBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryJuridicalBean.java index 6d39ef0..1b7cb46 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryJuridicalBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanHistoryJuridicalBean.java @@ -1,8 +1,8 @@ /* * Arrebol Consultancy copyright. - * + * * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.web.beans.admin; @@ -41,43 +41,43 @@ import org.primefaces.event.RowEditEvent; @ViewScoped public class LoanHistoryJuridicalBean extends GenericBean implements Serializable, Datatable { - public void searchHistoricalAction() { - try { - if (getStarDate().after(getEndDate())) { - showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); - } else { - setLoan(getLoanCtrl().fillAllLoansJuridicalViewDatatable(getStarDate(), getEndDate())); - } - } catch (Exception e) { - } - } + public void searchHistoricalAction() { + try { + if (getStarDate().after(getEndDate())) { + showMessage(FacesMessage.SEVERITY_ERROR, getBundlePropertyFile().getString("generic.start.date"), getBundlePropertyFile().getString("generic.end.date.error")); + } else { + setLoan(getLoanCtrl().fillAllLoansJuridicalViewDatatable(getStarDate(), getEndDate())); + } + } catch (Exception e) { + } + } - public List fillDatatableLoan() { - return getLoanCtrl().fillAllLoansJuridicalViewDatatable(getStarDate(), getEndDate()); - } + public List fillDatatableLoan() { + return getLoanCtrl().fillAllLoansJuridicalViewDatatable(getStarDate(), getEndDate()); + } - public void changeBonusNewCustomer() { - loanCtrl.updateBonusNewCustomer(ActiveStatus.ENEBLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); - loan.clear(); - loan = fillDatatableLoan(); - selectedLoan = null; + public void changeBonusNewCustomer() { + loanCtrl.updateBonusNewCustomer(ActiveStatus.ENEBLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + loan.clear(); + loan = fillDatatableLoan(); + selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "El préstamo empezó a contar como bono de cliente nuevo."); - } + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "La compra de producto empezó a contar como bono de cliente nuevo."); + } - public void removeBonusNewCustomer() { - loanCtrl.updateBonusNewCustomer(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); - loan.clear(); - loan = fillDatatableLoan(); - selectedLoan = null; + public void removeBonusNewCustomer() { + loanCtrl.updateBonusNewCustomer(ActiveStatus.DISABLED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + loan.clear(); + loan = fillDatatableLoan(); + selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "El préstamo ya no contará como bono de cliente nuevo."); - } + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de bono", "La compra de producto ya no contará como bono de cliente nuevo."); + } - public void deleteFeeLoan() { + public void deleteFeeLoan() { + + /* if (selectedLoan.getEstatusPrestamo()== LoanStatus.APPROVED.getValue() || selectedLoan.getEstatusPrestamo() == LoanStatus.PENDING_RENOVATION.getValue()) { - /* if (selectedLoan.getEstatusPrestamo()== LoanStatus.APPROVED.getValue() || selectedLoan.getEstatusPrestamo() == LoanStatus.PENDING_RENOVATION.getValue()) { - List details = loanCtrl.getLoanDetailsFeeCurdatebyIdLoan(selectedLoan.getId()); if (details != null && !details.isEmpty()) { Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); @@ -99,74 +99,74 @@ public class LoanHistoryJuridicalBean extends GenericBean implements Serializabl else { showMessage(FacesMessage.SEVERITY_WARN, "No se puede eliminar la multa", "Solo puedes eliminar la multa de préstamos en estatus Aprobados o Pendiente por renovación"); - return; - }*/ - } - - public void changeRoute() { - if (!routeId.isEmpty()) { - if (loanCtrl.updateRouteById(new RouteCtlg(routeId), selectedLoan.getId(), getLoggedUser().getUser().getId())) { - showMessage(FacesMessage.SEVERITY_INFO, "Ruta modificada", "Se modificó correctamente."); - } else { - showMessage(FacesMessage.SEVERITY_WARN, "Ruta modificada", "Ocurrió un error durante el proceso."); - } - - } - } - - public void changeLoanType() { - if (selectedLoan.getEstatusPrestamo() != LoanStatus.TO_DELIVERY.getValue()) { - loanTypeId = ""; - selectedLoan = null; - showMessage(FacesMessage.SEVERITY_WARN, "No se puede cambiar el tipo de préstamo", "Solo puedes cambiar el monto a prestar de préstamos en estatus Por liberar"); return; - } - Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); - loanUpdate.setLoanType(new LoanType(loanTypeId)); - loanUpdate.setAmountToPay(loanTypeCtrl.getLoanTypeById(loanTypeId).getPaymentTotal()); - if (loanCtrl.updateLoan(loanUpdate)) { - loan.clear(); - loan = fillDatatableLoan(); - loanTypeId = ""; - selectedLoan = null; - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de préstamo", "El préstamo se cambió correctamente"); - } + }*/ + } - } + public void changeRoute() { + if (!routeId.isEmpty()) { + if (loanCtrl.updateRouteById(new RouteCtlg(routeId), selectedLoan.getId(), getLoggedUser().getUser().getId())) { + showMessage(FacesMessage.SEVERITY_INFO, "Ruta modificada", "Se modificó correctamente."); + } else { + showMessage(FacesMessage.SEVERITY_WARN, "Ruta modificada", "Ocurrió un error durante el proceso."); + } - public void deleteLoan() { - /* loanCtrl.updateLoanByStatusWeb(LoanStatus.DELETED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + } + } + + public void changeLoanType() { + if (selectedLoan.getEstatusPrestamo() != LoanStatus.TO_DELIVERY.getValue()) { + loanTypeId = ""; + selectedLoan = null; + showMessage(FacesMessage.SEVERITY_WARN, "No se puede cambiar el tipo de compra de producto", "Solo puedes cambiar el monto a pagar de compras de productos en estatus Por liberar"); + return; + } + Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); + loanUpdate.setLoanType(new LoanType(loanTypeId)); + loanUpdate.setAmountToPay(loanTypeCtrl.getLoanTypeById(loanTypeId).getPaymentTotal()); + if (loanCtrl.updateLoan(loanUpdate)) { + loan.clear(); + loan = fillDatatableLoan(); + loanTypeId = ""; + selectedLoan = null; + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de compra de producto", "La compra de producto se cambió correctamente"); + } + + } + + public void deleteLoan() { + /* loanCtrl.updateLoanByStatusWeb(LoanStatus.DELETED, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.DELETED, selectedLoan); loan.remove(selectedLoan); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Eliminado' de forma correcta.");*/ - } + } - public void changeApprovedStatus() { - /*loanCtrl.updateLoanByStatusWeb(LoanStatus.APPROVED, selectedLoan.getId(), getLoggedUser().getUser().getId()); + public void changeApprovedStatus() { + /*loanCtrl.updateLoanByStatusWeb(LoanStatus.APPROVED, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.APPROVED, selectedLoan); loan.clear(); loan = fillDatatableLoan(); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Aprobado' de forma correcta.");*/ - } + } - public void changeFinishStatus() { - /*loanCtrl.updateLoanByStatusWeb(LoanStatus.FINISH, selectedLoan.getId(), getLoggedUser().getUser().getId()); + public void changeFinishStatus() { + /*loanCtrl.updateLoanByStatusWeb(LoanStatus.FINISH, selectedLoan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.FINISH, selectedLoan); loan.clear(); loan = fillDatatableLoan(); selectedLoan = null; showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Aprobado' de forma correcta.");*/ - } + } - public void deletePaymentLoan() { + public void deletePaymentLoan() { + + /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { - /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { - List details = loanCtrl.getLoanDetailsCurdatebyIdLoan(selectedLoan.getId()); if (details != null && !details.isEmpty()) { Loan loanUpdate = loanCtrl.getLoanById(selectedLoan.getId()); @@ -188,17 +188,17 @@ public class LoanHistoryJuridicalBean extends GenericBean implements Serializabl else { showMessage(FacesMessage.SEVERITY_WARN, "No se puede eliminar abono", "Solo puedes eliminar el abono de préstamos en estatus Aprobados o Pendiente por renovación"); - return; + return; }*/ - } + } - @Override - public void editRow(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void editRow(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - public void addPayment() { - /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { + public void addPayment() { + /*if (selectedLoan.getLoanStatus() == LoanStatus.APPROVED || selectedLoan.getLoanStatus() == LoanStatus.PENDING_RENOVATION) { LoanDetails detail = new LoanDetails(); detail.setComments(comments); detail.setCreatedBy(getLoggedUser().getUser().getId()); @@ -239,10 +239,10 @@ public class LoanHistoryJuridicalBean extends GenericBean implements Serializabl return; }*/ - } + } - public void addFee() { - /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { + public void addFee() { + /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { selectedLoan = null; userId = ""; comments = ""; @@ -282,10 +282,10 @@ public class LoanHistoryJuridicalBean extends GenericBean implements Serializabl fee = BigDecimal.ZERO; showMessage(FacesMessage.SEVERITY_INFO, "Agregar multa", "Se agregó la multa de forma correcta."); }*/ - } + } - public void changeOwner() { - /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { + public void changeOwner() { + /*if (selectedLoan.getLoanStatus() != LoanStatus.APPROVED) { selectedLoan = null; userId = ""; showMessage(FacesMessage.SEVERITY_WARN, "No se puede modificar propietario", "Solo puedes cambiar de propietario a préstamos en estatus Aprobados"); @@ -319,228 +319,228 @@ public class LoanHistoryJuridicalBean extends GenericBean implements Serializabl selectedLoan = null; showMessage(FacesMessage.SEVERITY_ERROR, "Cambio de propietario", "Ocurrió un error al intentar hacer el cambio de propietario."); }*/ - } + } - /** - * - */ - private void initStartAndEndDates() { - try { - Calendar starDateCalendar = Calendar.getInstance(); + /** + * + */ + private void initStartAndEndDates() { + try { + Calendar starDateCalendar = Calendar.getInstance(); - starDateCalendar.setTime(DateWrapper.getTodayMXTime()); - starDateCalendar.add(Calendar.MONTH, -1); + starDateCalendar.setTime(DateWrapper.getTodayMXTime()); + starDateCalendar.add(Calendar.MONTH, -1); - setStarDate(starDateCalendar.getTime()); - setEndDate(DateWrapper.getTodayMXTime()); - } catch (Exception e) { + setStarDate(starDateCalendar.getTime()); + setEndDate(DateWrapper.getTodayMXTime()); + } catch (Exception e) { - } - } + } + } - public void approvedLoan() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + public void approvedLoan() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowCancel(RowEditEvent event) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void onRowCancel(RowEditEvent event) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void onRowReorder(ReorderEvent event) { - showMessage(FacesMessage.SEVERITY_INFO, "Registro Movido", "De columna: " + (event.getFromIndex() + 1) + " a columna: " + (event.getToIndex() + 1)); - } + @Override + public void onRowReorder(ReorderEvent event) { + showMessage(FacesMessage.SEVERITY_INFO, "Registro Movido", "De columna: " + (event.getFromIndex() + 1) + " a columna: " + (event.getToIndex() + 1)); + } - @Override - public void addRow() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void addRow() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - @Override - public void deleteRow() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + @Override + public void deleteRow() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } - /** - * - * @param outcome - * @return - */ - public String detailLoan(String outcome) { - return outcome; - } + /** + * + * @param outcome + * @return + */ + public String detailLoan(String outcome) { + return outcome; + } - public LoanController getLoanCtrl() { - return loanCtrl; - } + public LoanController getLoanCtrl() { + return loanCtrl; + } - public void setLoanCtrl(LoanController loanCtrl) { - this.loanCtrl = loanCtrl; - } + public void setLoanCtrl(LoanController loanCtrl) { + this.loanCtrl = loanCtrl; + } - public List getLoan() { - return loan; - } + public List getLoan() { + return loan; + } - public void setLoan(List loan) { - this.loan = loan; - } + public void setLoan(List loan) { + this.loan = loan; + } - public HistoryLoanView getSelectedLoan() { - return selectedLoan; - } + public HistoryLoanView getSelectedLoan() { + return selectedLoan; + } - public void setSelectedLoan(HistoryLoanView selectedLoan) { - this.selectedLoan = selectedLoan; - } + public void setSelectedLoan(HistoryLoanView selectedLoan) { + this.selectedLoan = selectedLoan; + } - public String getComments() { - return comments; - } + public String getComments() { + return comments; + } - public void setComments(String comments) { - this.comments = comments; - } + public void setComments(String comments) { + this.comments = comments; + } - public GenericController getGenericCtrl() { - return genericCtrl; - } + public GenericController getGenericCtrl() { + return genericCtrl; + } - public void setGenericCtrl(GenericController genericCtrl) { - this.genericCtrl = genericCtrl; - } + public void setGenericCtrl(GenericController genericCtrl) { + this.genericCtrl = genericCtrl; + } - public List getUsers() { - return users; - } + public List getUsers() { + return users; + } - public void setUsers(List users) { - this.users = users; - } + public void setUsers(List users) { + this.users = users; + } - public String getUserId() { - return userId; - } + public String getUserId() { + return userId; + } - public void setUserId(String userId) { - this.userId = userId; - } + public void setUserId(String userId) { + this.userId = userId; + } - public BigDecimal getPayment() { - return payment; - } + public BigDecimal getPayment() { + return payment; + } - public void setPayment(BigDecimal payment) { - this.payment = payment; - } + public void setPayment(BigDecimal payment) { + this.payment = payment; + } - public BigDecimal getFee() { - return fee; - } + public BigDecimal getFee() { + return fee; + } - public void setFee(BigDecimal fee) { - this.fee = fee; - } + public void setFee(BigDecimal fee) { + this.fee = fee; + } - public LoanTypeController getLoanTypeCtrl() { - return loanTypeCtrl; - } + public LoanTypeController getLoanTypeCtrl() { + return loanTypeCtrl; + } - public void setLoanTypeCtrl(LoanTypeController loanTypeCtrl) { - this.loanTypeCtrl = loanTypeCtrl; - } + public void setLoanTypeCtrl(LoanTypeController loanTypeCtrl) { + this.loanTypeCtrl = loanTypeCtrl; + } - public List getLoanType() { - return loanType; - } + public List getLoanType() { + return loanType; + } - public void setLoanType(List loanType) { - this.loanType = loanType; - } + public void setLoanType(List loanType) { + this.loanType = loanType; + } - public String getLoanTypeId() { - return loanTypeId; - } + public String getLoanTypeId() { + return loanTypeId; + } - public void setLoanTypeId(String loanTypeId) { - this.loanTypeId = loanTypeId; - } + public void setLoanTypeId(String loanTypeId) { + this.loanTypeId = loanTypeId; + } - public String getRouteId() { - return routeId; - } + public String getRouteId() { + return routeId; + } - public void setRouteId(String routeId) { - this.routeId = routeId; - } + public void setRouteId(String routeId) { + this.routeId = routeId; + } - public RouteController getRouteCtrl() { - return routeCtrl; - } + public RouteController getRouteCtrl() { + return routeCtrl; + } - public void setRouteCtrl(RouteController routeCtrl) { - this.routeCtrl = routeCtrl; - } + public void setRouteCtrl(RouteController routeCtrl) { + this.routeCtrl = routeCtrl; + } - public List getRoute() { - return route; - } + public List getRoute() { + return route; + } - public void setRoute(List route) { - this.route = route; - } + public void setRoute(List route) { + this.route = route; + } - public Date getStarDate() { - return starDate; - } + public Date getStarDate() { + return starDate; + } - public void setStarDate(Date starDate) { - this.starDate = starDate; - } + public void setStarDate(Date starDate) { + this.starDate = starDate; + } - public Date getEndDate() { - return endDate; - } + public Date getEndDate() { + return endDate; + } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } + public void setEndDate(Date endDate) { + this.endDate = endDate; + } - private LoanController loanCtrl; - private LoanTypeController loanTypeCtrl; - private GenericController genericCtrl; - private RouteController routeCtrl; + private LoanController loanCtrl; + private LoanTypeController loanTypeCtrl; + private GenericController genericCtrl; + private RouteController routeCtrl; - private List loan; - private List users; - private List loanType; - private List route; - private HistoryLoanView selectedLoan; - private String comments; - private String userId; - private BigDecimal payment; - private BigDecimal fee; - private String loanTypeId; - private String routeId; + private List loan; + private List users; + private List loanType; + private List route; + private HistoryLoanView selectedLoan; + private String comments; + private String userId; + private BigDecimal payment; + private BigDecimal fee; + private String loanTypeId; + private String routeId; - private Date starDate; - private Date endDate; + private Date starDate; + private Date endDate; - @PostConstruct - public void init() { - loadBundlePropertyFile(); - - loanCtrl = new LoanController(); - genericCtrl = new GenericController(); - loanTypeCtrl = new LoanTypeController(); - routeCtrl = new RouteController(); - initStartAndEndDates(); - users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); - loanType = loanTypeCtrl.fillLoanTypeDatatable(getLoggedUser().getOffice().getId()); - route = routeCtrl.fillRoutesDatatable(getLoggedUser().getOffice().getId()); + @PostConstruct + public void init() { + loadBundlePropertyFile(); - setLoan(fillDatatableLoan()); - } + loanCtrl = new LoanController(); + genericCtrl = new GenericController(); + loanTypeCtrl = new LoanTypeController(); + routeCtrl = new RouteController(); + initStartAndEndDates(); + users = genericCtrl.getAllUsersByOffice(getLoggedUser().getOffice().getId()); + loanType = loanTypeCtrl.fillLoanTypeDatatable(getLoggedUser().getOffice().getId()); + route = routeCtrl.fillRoutesDatatable(getLoggedUser().getOffice().getId()); + + setLoan(fillDatatableLoan()); + } } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingBean.java index 1b8cbb7..6bf43f5 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingBean.java @@ -143,7 +143,7 @@ public class LoanPendingBean extends GenericBean implements Serializable, Datata Calendar fechaAct = Calendar.getInstance(); if (fechaAct.before(calendar)) { Bitacora bitacora = new Bitacora(); - bitacora.setAction("Préstamo postfechado"); + bitacora.setAction("Compra de producto postfechado"); bitacora.setCommentsUser(""); bitacora.setCreatedBy(getLoggedUser().getUser().getId()); bitacora.setCreatedOn(new Date()); diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingDetailBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingDetailBean.java index b7587ef..a28c125 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingDetailBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/LoanPendingDetailBean.java @@ -43,7 +43,7 @@ public class LoanPendingDetailBean extends GenericBean implements Serializable, loan.setLoanType(new LoanType(typeLoanId)); loan.setAmountToPay(loanTypeCtrl.getLoanTypeById(typeLoanId).getPaymentTotal()); if (loanCtrl.updateLoan(loan)) { - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de préstamo", "El préstamo se cambió correctamente"); + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de tipo de compra de producto", "La compra de producto se cambió correctamente"); } } @@ -90,13 +90,13 @@ public class LoanPendingDetailBean extends GenericBean implements Serializable, loanCtrl.updateLoanByUserByStatus(LoanStatus.APPROVED, renovation.getLoanOld()); } - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'Rechazado' de forma correcta."); + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "La compra de producto se cambió a estatus 'Rechazado' de forma correcta."); } public void approvedLoan() { loanCtrl.updateLoanByStatus(LoanStatus.TO_DELIVERY, loan.getId(), getLoggedUser().getUser().getId()); loanCtrl.updateLoanByUserByStatus(LoanStatus.TO_DELIVERY, loan); - showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "El préstamo se cambió a estatus 'A conciliar' de forma correcta."); + showMessage(FacesMessage.SEVERITY_INFO, "Cambio de estatus", "La compra de producto se cambió a estatus 'A conciliar' de forma correcta."); } @Override diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/people/PersonCustomerBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/people/PersonCustomerBean.java index af8a97c..fabd6f0 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/people/PersonCustomerBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/admin/people/PersonCustomerBean.java @@ -199,11 +199,11 @@ public class PersonCustomerBean extends GenericBean implements Serializable { Calendar fechaAct = Calendar.getInstance(); if (fechaAct.before(calendar)) { Bitacora bitacora = new Bitacora(); - bitacora.setAction("Préstamo postfechado"); + bitacora.setAction("Compra de producto postfechado"); bitacora.setCommentsUser(""); bitacora.setCreatedBy(getLoggedUser().getUser().getId()); bitacora.setCreatedOn(new Date()); - bitacora.setDescription("El usuario " + userName + " postfechó el préstamo del cliente " + temp.getCustomer().getFullName() + bitacora.setDescription("El usuario " + userName + " postfechó la compra de producto del cliente " + temp.getCustomer().getFullName() + ", con cantidad de $" + temp.getLoanType().getPayment() + " al día " + temp.getCreatedOn()); bitacora.setNameUser(getLoggedUser().getUser().getUserName()); bitacora.setOffice(new Office(getLoggedUser().getOffice().getId())); @@ -280,11 +280,11 @@ public class PersonCustomerBean extends GenericBean implements Serializable { setAutoCompleteCustomer(null); setAutoCompleteEndorsement(null); //loan = fillDatatableLoan(); - showMessage(FacesMessage.SEVERITY_INFO, "Cliente", "Se agrego el prestamo al cliente correctamente."); + showMessage(FacesMessage.SEVERITY_INFO, "Cliente", "Se agrego la compra de producto al cliente correctamente."); } catch (Exception e) { logger.error("", e); - showMessage(FacesMessage.SEVERITY_INFO, "Cliente", "No se agrego el nuevo prestamos al cliente."); + showMessage(FacesMessage.SEVERITY_INFO, "Cliente", "No se agrego la nueva compra de producto al cliente."); } } diff --git a/apc-web/src/main/java/com/arrebol/apc/web/beans/system/employee/EmployeeBean.java b/apc-web/src/main/java/com/arrebol/apc/web/beans/system/employee/EmployeeBean.java index 0b10e19..c399bf2 100644 --- a/apc-web/src/main/java/com/arrebol/apc/web/beans/system/employee/EmployeeBean.java +++ b/apc-web/src/main/java/com/arrebol/apc/web/beans/system/employee/EmployeeBean.java @@ -1,8 +1,8 @@ /* * Arrebol Consultancy copyright. - * + * * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.web.beans.system.employee; @@ -38,585 +38,585 @@ import org.apache.logging.log4j.Logger; @ViewScoped public class EmployeeBean extends GenericBean implements Serializable { - public void saveHR() { - logger.debug("saveHR"); - try { - getSaveHumanResource().setAvatar("images/avatar.png"); - getSaveHumanResource().setRoleCtlg(new RoleCtlg(role)); - getSaveHumanResource().setHumanResourceStatus(HumanResourceStatus.ENEBLED); - getSaveHumanResource().setCreatedBy(getLoggedUser().getUser().getId()); - getSaveHumanResource().setBalance(BigDecimal.ZERO); - - if (getSaveHumanResource().getEmployeeSaving() == null) { - getSaveHumanResource().setEmployeeSaving(BigDecimal.ZERO); + public void saveHR() { + logger.debug("saveHR"); + try { + getSaveHumanResource().setAvatar("images/avatar.png"); + getSaveHumanResource().setRoleCtlg(new RoleCtlg(role)); + getSaveHumanResource().setHumanResourceStatus(HumanResourceStatus.ENEBLED); + getSaveHumanResource().setCreatedBy(getLoggedUser().getUser().getId()); + getSaveHumanResource().setBalance(BigDecimal.ZERO); + + if (getSaveHumanResource().getEmployeeSaving() == null) { + getSaveHumanResource().setEmployeeSaving(BigDecimal.ZERO); + } + + String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); + FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; + + HumanResourceByOffice humanResourceByOffice = new HumanResourceByOffice( + new Office(getLoggedUser().getOffice().getId()), + getLoggedUser().getUser().getId(), + new Date(), + ApplicationOwner.APP_USER + ); + + if (null != getBonusId() && getBonusId().length() == 36) { + getSaveHumanResource().setBonus(new Bonus(getBonusId())); + } + + if (getController().saveHRController(humanResourceByOffice, getSaveHumanResource())) { + setSaveHumanResource(new HumanResource()); + + messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); + severity = FacesMessage.SEVERITY_INFO; + + refreshDropBox(); + } + Object[] param = {getBundlePropertyFile().getString("employee"), getBundlePropertyFile().getString("created")}; + + buildAndSendMessage(param, messafeFormat, severity, getBundlePropertyFile().getString("employee")); + } catch (Exception e) { + logger.error("saveHR", e); + Object[] param = {getBundlePropertyFile().getString("created")}; + + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("employee") + ); + } + } + + /** + * + * @param action 1 = TO DISABLED, 2 = TO ENEBLED, 3 = TO DELETED, 4 NOT + * ALLOWED + */ + public void actionDropBox(int action) { + logger.debug("actionDropBox"); + try { + String messageTitle = getBundlePropertyFile().getString("employee"); + String actionUserIdSelected = null; + String messageAction = null; + + HumanResourceStatus status = null; + + switch (action) { + case 1: + actionUserIdSelected = getEnebledId(); + messageAction = getBundlePropertyFile().getString("disabled"); + status = HumanResourceStatus.DISABLED; + break; + case 2: + actionUserIdSelected = getDisabledId(); + messageAction = getBundlePropertyFile().getString("enebled"); + status = HumanResourceStatus.ENEBLED; + break; + case 3: + actionUserIdSelected = getDeletedId(); + messageAction = getBundlePropertyFile().getString("deleted"); + status = HumanResourceStatus.DELETED; + break; + default: + throw new Exception(action + " is NOT valid a option"); + } + + if (executeAction(status, actionUserIdSelected, messageTitle, messageAction)) { + refreshDropBox(); + } + } catch (Exception e) { + logger.error("actionDropBox", e); + Object[] param = {getBundlePropertyFile().getString("employee")}; + + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("process") + ); + } + } + + public void updateSlctBtnHRAction() { + logger.debug("updateHR"); + try { + getUpdateHumanResource().setLastUpdatedBy(getLoggedUser().getUser().getId()); + getUpdateHumanResource().setLastUpdatedOn(new Date()); + getUpdateHumanResource().setRoleCtlg(new RoleCtlg(roleUpdate)); + + if (getUpdateHumanResource().getEmployeeSaving() == null) { + getUpdateHumanResource().setEmployeeSaving(BigDecimal.ZERO); + } + + String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); + FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; + + if (null != getBonusId() && getBonusId().length() == 36) { + getUpdateHumanResource().setBonus(new Bonus(getBonusId())); + } + + if (getController().updateByHumanResourceId(getUpdateHumanResource(), false)) { + messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); + severity = FacesMessage.SEVERITY_INFO; + } + + Object[] param = {getBundlePropertyFile().getString("employee"), getBundlePropertyFile().getString("updated")}; + + buildAndSendMessage(param, messafeFormat, severity, getBundlePropertyFile().getString("employee")); + } catch (Exception e) { + logger.error("updateSlctBtnHRActionListener", e); + Object[] param = {getBundlePropertyFile().getString("updated")}; + + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("employee") + ); + } + } + + public void loadUserToUpdate() { + try { + setUpdateHumanResource(getController().findHumanResourceById(getUpdateId())); + setRoleUpdate(getUpdateHumanResource().getBonus().getId()); + updateBonusId = getRoleUpdate(); + } catch (Exception e) { + logger.error("updateSlctBtnHRActionListener", e); + Object[] param = {getBundlePropertyFile().getString("searching")}; + + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("employee") + ); + } + } + + /** + * + * @param option 1 = to disabled, 2 = to enebled, 4 = to updated + */ + public void enebledDisabledDropBoxListener(int option) { + logger.debug("enebledDisabledDropBoxListener"); + try { + HumanResourceStatus status = HumanResourceStatus.ENEBLED; + + boolean goAHead = false; + + switch (option) { + case 1: + if (isEnebledHR()) { + goAHead = isEnebledHR(); + } else { + setEnebledHumanResourcesLst(null); + } + break; + case 2: + if (isDisabledHR()) { + goAHead = isDisabledHR(); + } else { + setDeletedHumanResourcesLst(null); + } + break; + case 4: + if (isSelectedUpdateHR()) { + goAHead = isSelectedUpdateHR(); + } else { + setUpdateHumanResourcesLst(null); + setUpdateHumanResource(new HumanResource()); + setRoleUpdate("N/A"); + } + break; + } + + if (goAHead) { + if (2 == option) { + status = HumanResourceStatus.DISABLED; } - String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); - FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; - - HumanResourceByOffice humanResourceByOffice = new HumanResourceByOffice( + List results = getController().findEmployeesByType( new Office(getLoggedUser().getOffice().getId()), - getLoggedUser().getUser().getId(), - new Date(), - ApplicationOwner.APP_USER + status, + getLoggedUser().getUser().getHumanResource().getId() ); - if (null != getBonusId() && getBonusId().length() == 36) { - getSaveHumanResource().setBonus(new Bonus(getBonusId())); - } - - if (getController().saveHRController(humanResourceByOffice, getSaveHumanResource())) { - setSaveHumanResource(new HumanResource()); - - messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); - severity = FacesMessage.SEVERITY_INFO; - - refreshDropBox(); - } - Object[] param = {getBundlePropertyFile().getString("employee"), getBundlePropertyFile().getString("created")}; - - buildAndSendMessage(param, messafeFormat, severity, getBundlePropertyFile().getString("employee")); - } catch (Exception e) { - logger.error("saveHR", e); - Object[] param = {getBundlePropertyFile().getString("created")}; - - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("employee") - ); - } - } - - /** - * - * @param action 1 = TO DISABLED, 2 = TO ENEBLED, 3 = TO DELETED, 4 NOT - * ALLOWED - */ - public void actionDropBox(int action) { - logger.debug("actionDropBox"); - try { - String messageTitle = getBundlePropertyFile().getString("employee"); - String actionUserIdSelected = null; - String messageAction = null; - - HumanResourceStatus status = null; - - switch (action) { - case 1: - actionUserIdSelected = getEnebledId(); - messageAction = getBundlePropertyFile().getString("disabled"); - status = HumanResourceStatus.DISABLED; - break; - case 2: - actionUserIdSelected = getDisabledId(); - messageAction = getBundlePropertyFile().getString("enebled"); - status = HumanResourceStatus.ENEBLED; - break; - case 3: - actionUserIdSelected = getDeletedId(); - messageAction = getBundlePropertyFile().getString("deleted"); - status = HumanResourceStatus.DELETED; - break; - default: - throw new Exception(action + " is NOT valid a option"); - } - - if (executeAction(status, actionUserIdSelected, messageTitle, messageAction)) { - refreshDropBox(); - } - } catch (Exception e) { - logger.error("actionDropBox", e); - Object[] param = {getBundlePropertyFile().getString("employee")}; - - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("process") - ); - } - } - - public void updateSlctBtnHRAction() { - logger.debug("updateHR"); - try { - getUpdateHumanResource().setLastUpdatedBy(getLoggedUser().getUser().getId()); - getUpdateHumanResource().setLastUpdatedOn(new Date()); - getUpdateHumanResource().setRoleCtlg(new RoleCtlg(roleUpdate)); - - if (getUpdateHumanResource().getEmployeeSaving() == null) { - getUpdateHumanResource().setEmployeeSaving(BigDecimal.ZERO); - } - - String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); - FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; - - if (null != getBonusId() && getBonusId().length() == 36) { - getUpdateHumanResource().setBonus(new Bonus(getBonusId())); - } - - if (getController().updateByHumanResourceId(getUpdateHumanResource(), false)) { - messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); - severity = FacesMessage.SEVERITY_INFO; - } - - Object[] param = {getBundlePropertyFile().getString("employee"), getBundlePropertyFile().getString("updated")}; - - buildAndSendMessage(param, messafeFormat, severity, getBundlePropertyFile().getString("employee")); - } catch (Exception e) { - logger.error("updateSlctBtnHRActionListener", e); - Object[] param = {getBundlePropertyFile().getString("updated")}; - - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("employee") - ); - } - } - - public void loadUserToUpdate() { - try { - setUpdateHumanResource(getController().findHumanResourceById(getUpdateId())); - setRoleUpdate(getUpdateHumanResource().getBonus().getId()); - updateBonusId = getRoleUpdate(); - } catch (Exception e) { - logger.error("updateSlctBtnHRActionListener", e); - Object[] param = {getBundlePropertyFile().getString("searching")}; - - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("employee") - ); - } - } - - /** - * - * @param option 1 = to disabled, 2 = to enebled, 4 = to updated - */ - public void enebledDisabledDropBoxListener(int option) { - logger.debug("enebledDisabledDropBoxListener"); - try { - HumanResourceStatus status = HumanResourceStatus.ENEBLED; - - boolean goAHead = false; - switch (option) { - case 1: - if (isEnebledHR()) { - goAHead = isEnebledHR(); - } else { - setEnebledHumanResourcesLst(null); - } - break; - case 2: - if (isDisabledHR()) { - goAHead = isDisabledHR(); - } else { - setDeletedHumanResourcesLst(null); - } - break; - case 4: - if (isSelectedUpdateHR()) { - goAHead = isSelectedUpdateHR(); - } else { - setUpdateHumanResourcesLst(null); - setUpdateHumanResource(new HumanResource()); - setRoleUpdate("N/A"); - } - break; + case 1: + setEnebledHumanResourcesLst(results); + break; + case 2: + setDisabledHumanResourcesLst(results); + break; + case 4: + setUpdateHumanResourcesLst(results); + setUpdateHumanResource(new HumanResource()); + break; } + } + } catch (Exception e) { + logger.error("enebledDisabledDropBoxListener"); - if (goAHead) { - if (2 == option) { - status = HumanResourceStatus.DISABLED; - } + Object[] param = {getBundlePropertyFile().getString("searching")}; - List results = getController().findEmployeesByType( - new Office(getLoggedUser().getOffice().getId()), - status, - getLoggedUser().getUser().getHumanResource().getId() - ); + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("employee") + ); + } + } - switch (option) { - case 1: - setEnebledHumanResourcesLst(results); - break; - case 2: - setDisabledHumanResourcesLst(results); - break; - case 4: - setUpdateHumanResourcesLst(results); - setUpdateHumanResource(new HumanResource()); - break; - } - } - } catch (Exception e) { - logger.error("enebledDisabledDropBoxListener"); + public void deletedHRListener() { + try { + if (isDeletedHR()) { + List statusLst = new ArrayList<>(); - Object[] param = {getBundlePropertyFile().getString("searching")}; + statusLst.add(HumanResourceStatus.ENEBLED); + statusLst.add(HumanResourceStatus.DISABLED); - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("employee") + setDeletedHumanResourcesLst( + getController().findEmployeesInType( + new Office(getLoggedUser().getOffice().getId()), + statusLst, + getLoggedUser().getUser().getHumanResource().getId() + ) ); - } - } + } else { + setDeletedHumanResourcesLst(null); + } + } catch (Exception e) { + logger.error("deletedHRListener", e); + Object[] param = {getBundlePropertyFile().getString("searching")}; - public void deletedHRListener() { - try { - if (isDeletedHR()) { - List statusLst = new ArrayList<>(); + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + getBundlePropertyFile().getString("employee") + ); + } + } - statusLst.add(HumanResourceStatus.ENEBLED); - statusLst.add(HumanResourceStatus.DISABLED); + /** + * + * @param status + * @param userIdSelected + * @param msgTitle + * @param msgAction + */ + private boolean executeAction(HumanResourceStatus status, String userIdSelected, String msgTitle, String msgAction) { + logger.debug("executeAction"); - setDeletedHumanResourcesLst( - getController().findEmployeesInType( - new Office(getLoggedUser().getOffice().getId()), - statusLst, - getLoggedUser().getUser().getHumanResource().getId() - ) - ); - } else { - setDeletedHumanResourcesLst(null); - } - } catch (Exception e) { - logger.error("deletedHRListener", e); - Object[] param = {getBundlePropertyFile().getString("searching")}; + boolean success = false; - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - getBundlePropertyFile().getString("employee") - ); - } - } + try { + String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); + FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; - /** - * - * @param status - * @param userIdSelected - * @param msgTitle - * @param msgAction - */ - private boolean executeAction(HumanResourceStatus status, String userIdSelected, String msgTitle, String msgAction) { - logger.debug("executeAction"); + success = getController().updateHRByStatus(status, userIdSelected, getLoggedUser().getUser().getId()); - boolean success = false; + if (success) { + logger.debug("executeAction"); - try { - String messafeFormat = getBundlePropertyFile().getString("message.format.failure"); - FacesMessage.Severity severity = FacesMessage.SEVERITY_WARN; + messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); + severity = FacesMessage.SEVERITY_INFO; + } - success = getController().updateHRByStatus(status, userIdSelected, getLoggedUser().getUser().getId()); + Object[] param = {msgTitle, msgAction}; - if (success) { - logger.debug("executeAction"); + buildAndSendMessage(param, messafeFormat, severity, msgTitle); + } catch (Exception e) { + logger.error("executeAction", e); + Object[] param = {msgTitle}; - messafeFormat = getBundlePropertyFile().getString("message.format.sucess"); - severity = FacesMessage.SEVERITY_INFO; - } + buildAndSendMessage( + param, + getBundlePropertyFile().getString("message.format.fatal"), + FacesMessage.SEVERITY_FATAL, + msgTitle + ); + } + return success; + } - Object[] param = {msgTitle, msgAction}; + private void refreshDropBox() { + try { + if (isEnebledHR()) { + enebledDisabledDropBoxListener(1); + } + if (isDisabledHR()) { + enebledDisabledDropBoxListener(2); + } - buildAndSendMessage(param, messafeFormat, severity, msgTitle); - } catch (Exception e) { - logger.error("executeAction", e); - Object[] param = {msgTitle}; + if (isDeletedHR()) { + deletedHRListener(); + } - buildAndSendMessage( - param, - getBundlePropertyFile().getString("message.format.fatal"), - FacesMessage.SEVERITY_FATAL, - msgTitle - ); - } - return success; - } + if (isSelectedUpdateHR()) { + enebledDisabledDropBoxListener(4); + } + } catch (Exception e) { + logger.error("executeAction", e); + } + } - private void refreshDropBox() { - try { - if (isEnebledHR()) { - enebledDisabledDropBoxListener(1); - } - if (isDisabledHR()) { - enebledDisabledDropBoxListener(2); - } + private static final long serialVersionUID = 2969985354193657703L; + final Logger logger = LogManager.getLogger(EmployeeBean.class); - if (isDeletedHR()) { - deletedHRListener(); - } + private EmployeeController controller; + private RoleController roleCtrl; - if (isSelectedUpdateHR()) { - enebledDisabledDropBoxListener(4); - } - } catch (Exception e) { - logger.error("executeAction", e); - } - } + private HumanResource saveHumanResource; + private HumanResource updateHumanResource; - private static final long serialVersionUID = 2969985354193657703L; - final Logger logger = LogManager.getLogger(EmployeeBean.class); + private String role; + private List roles; - private EmployeeController controller; - private RoleController roleCtrl; + private boolean selectedUpdateHR; + private String updateId; - private HumanResource saveHumanResource; - private HumanResource updateHumanResource; + private String roleUpdate; + private List updateHumanResourcesLst; + private List typeLst; - private String role; - private List roles; + private boolean enebledHR; + private String enebledId; + private List enebledHumanResourcesLst; - private boolean selectedUpdateHR; - private String updateId; + private boolean disabledHR; + private String disabledId; + private List disabledHumanResourcesLst; - private String roleUpdate; - private List updateHumanResourcesLst; - private List typeLst; + private boolean deletedHR; + private String deletedId; + private List deletedHumanResourcesLst; - private boolean enebledHR; - private String enebledId; - private List enebledHumanResourcesLst; + private String bonusId; + private List bonuses; + private String updateBonusId; - private boolean disabledHR; - private String disabledId; - private List disabledHumanResourcesLst; + @PostConstruct() + public void init() { + try { + loadBundlePropertyFile(); + setController(new EmployeeController()); + setRoleCtrl(new RoleController()); + setSaveHumanResource(new HumanResource()); + setUpdateHumanResource(new HumanResource()); + roles = getRoleCtrl().fillRolesDatatable(); + setBonuses(getController().findAllActiveBonus(getLoggedUser().getOffice().getId())); + } catch (Exception e) { + logger.error("init", e); + } + } - private boolean deletedHR; - private String deletedId; - private List deletedHumanResourcesLst; + @PreDestroy + public void finish() { + try { + setSaveHumanResource(new HumanResource()); + setUpdateHumanResource(new HumanResource()); + setController(null); + } catch (Exception e) { + logger.error("finish", e); + } + } - private String bonusId; - private List bonuses; - private String updateBonusId; + public RoleController getRoleCtrl() { + return roleCtrl; + } - @PostConstruct() - public void init() { - try { - loadBundlePropertyFile(); - setController(new EmployeeController()); - setRoleCtrl(new RoleController()); - setSaveHumanResource(new HumanResource()); - setUpdateHumanResource(new HumanResource()); - roles = getRoleCtrl().fillRolesDatatable(); - setBonuses(getController().findAllActiveBonus(getLoggedUser().getOffice().getId())); - } catch (Exception e) { - logger.error("init", e); - } - } + public void setRoleCtrl(RoleController roleCtrl) { + this.roleCtrl = roleCtrl; + } - @PreDestroy - public void finish() { - try { - setSaveHumanResource(new HumanResource()); - setUpdateHumanResource(new HumanResource()); - setController(null); - } catch (Exception e) { - logger.error("finish", e); - } - } + public EmployeeController getController() { + return controller; + } - public RoleController getRoleCtrl() { - return roleCtrl; - } + public void setController(EmployeeController controller) { + this.controller = controller; + } - public void setRoleCtrl(RoleController roleCtrl) { - this.roleCtrl = roleCtrl; - } + public HumanResource getSaveHumanResource() { + return saveHumanResource; + } - public EmployeeController getController() { - return controller; - } + public void setSaveHumanResource(HumanResource saveHumanResource) { + this.saveHumanResource = saveHumanResource; + } - public void setController(EmployeeController controller) { - this.controller = controller; - } + public HumanResource getUpdateHumanResource() { + return updateHumanResource; + } - public HumanResource getSaveHumanResource() { - return saveHumanResource; - } + public void setUpdateHumanResource(HumanResource updateHumanResource) { + this.updateHumanResource = updateHumanResource; + } - public void setSaveHumanResource(HumanResource saveHumanResource) { - this.saveHumanResource = saveHumanResource; - } + public String getRole() { + return role; + } - public HumanResource getUpdateHumanResource() { - return updateHumanResource; - } + public void setRole(String role) { + this.role = role; + } - public void setUpdateHumanResource(HumanResource updateHumanResource) { - this.updateHumanResource = updateHumanResource; - } - - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - public List getRoles() { - if (null == roles) { - /* + public List getRoles() { + if (null == roles) { + /* roles = Stream.of( HumanResourceType.values()) .map(Enum::name) .collect(Collectors.toList() ); - */ - } - return roles; - } + */ + } + return roles; + } - public void setRoles(List roles) { - this.roles = roles; - } + public void setRoles(List roles) { + this.roles = roles; + } - public boolean isSelectedUpdateHR() { - return selectedUpdateHR; - } + public boolean isSelectedUpdateHR() { + return selectedUpdateHR; + } - public void setSelectedUpdateHR(boolean selectedUpdateHR) { - this.selectedUpdateHR = selectedUpdateHR; - } + public void setSelectedUpdateHR(boolean selectedUpdateHR) { + this.selectedUpdateHR = selectedUpdateHR; + } - public String getUpdateId() { - return updateId; - } + public String getUpdateId() { + return updateId; + } - public void setUpdateId(String updateId) { - this.updateId = updateId; - } + public void setUpdateId(String updateId) { + this.updateId = updateId; + } - public String getRoleUpdate() { - return roleUpdate; - } + public String getRoleUpdate() { + return roleUpdate; + } - public void setRoleUpdate(String roleUpdate) { - this.roleUpdate = roleUpdate; - } + public void setRoleUpdate(String roleUpdate) { + this.roleUpdate = roleUpdate; + } - public List getUpdateHumanResourcesLst() { - return updateHumanResourcesLst; - } + public List getUpdateHumanResourcesLst() { + return updateHumanResourcesLst; + } - public void setUpdateHumanResourcesLst(List updateHumanResourcesLst) { - this.updateHumanResourcesLst = updateHumanResourcesLst; - } + public void setUpdateHumanResourcesLst(List updateHumanResourcesLst) { + this.updateHumanResourcesLst = updateHumanResourcesLst; + } - public List getTypeLst() { - return typeLst; - } + public List getTypeLst() { + return typeLst; + } - public void setTypeLst(List typeLst) { - this.typeLst = typeLst; - } + public void setTypeLst(List typeLst) { + this.typeLst = typeLst; + } - public boolean isEnebledHR() { - return enebledHR; - } + public boolean isEnebledHR() { + return enebledHR; + } - public void setEnebledHR(boolean enebledHR) { - this.enebledHR = enebledHR; - } + public void setEnebledHR(boolean enebledHR) { + this.enebledHR = enebledHR; + } - public String getEnebledId() { - return enebledId; - } + public String getEnebledId() { + return enebledId; + } - public void setEnebledId(String enebledId) { - this.enebledId = enebledId; - } + public void setEnebledId(String enebledId) { + this.enebledId = enebledId; + } - public List getEnebledHumanResourcesLst() { - return enebledHumanResourcesLst; - } + public List getEnebledHumanResourcesLst() { + return enebledHumanResourcesLst; + } - public void setEnebledHumanResourcesLst(List enebledHumanResourcesLst) { - this.enebledHumanResourcesLst = enebledHumanResourcesLst; - } + public void setEnebledHumanResourcesLst(List enebledHumanResourcesLst) { + this.enebledHumanResourcesLst = enebledHumanResourcesLst; + } - public boolean isDisabledHR() { - return disabledHR; - } + public boolean isDisabledHR() { + return disabledHR; + } - public void setDisabledHR(boolean disabledHR) { - this.disabledHR = disabledHR; - } + public void setDisabledHR(boolean disabledHR) { + this.disabledHR = disabledHR; + } - public String getDisabledId() { - return disabledId; - } + public String getDisabledId() { + return disabledId; + } - public void setDisabledId(String disabledId) { - this.disabledId = disabledId; - } + public void setDisabledId(String disabledId) { + this.disabledId = disabledId; + } - public List getDisabledHumanResourcesLst() { - return disabledHumanResourcesLst; - } + public List getDisabledHumanResourcesLst() { + return disabledHumanResourcesLst; + } - public void setDisabledHumanResourcesLst(List disabledHumanResourcesLst) { - this.disabledHumanResourcesLst = disabledHumanResourcesLst; - } + public void setDisabledHumanResourcesLst(List disabledHumanResourcesLst) { + this.disabledHumanResourcesLst = disabledHumanResourcesLst; + } - public boolean isDeletedHR() { - return deletedHR; - } + public boolean isDeletedHR() { + return deletedHR; + } - public void setDeletedHR(boolean deletedHR) { - this.deletedHR = deletedHR; - } + public void setDeletedHR(boolean deletedHR) { + this.deletedHR = deletedHR; + } - public String getDeletedId() { - return deletedId; - } + public String getDeletedId() { + return deletedId; + } - public void setDeletedId(String deletedId) { - this.deletedId = deletedId; - } + public void setDeletedId(String deletedId) { + this.deletedId = deletedId; + } - public List getDeletedHumanResourcesLst() { - return deletedHumanResourcesLst; - } + public List getDeletedHumanResourcesLst() { + return deletedHumanResourcesLst; + } - public void setDeletedHumanResourcesLst(List deletedHumanResourcesLst) { - this.deletedHumanResourcesLst = deletedHumanResourcesLst; - } + public void setDeletedHumanResourcesLst(List deletedHumanResourcesLst) { + this.deletedHumanResourcesLst = deletedHumanResourcesLst; + } - public String getBonusId() { - return bonusId; - } + public String getBonusId() { + return bonusId; + } - public void setBonusId(String bonusId) { - this.bonusId = bonusId; - } + public void setBonusId(String bonusId) { + this.bonusId = bonusId; + } - public List getBonuses() { - return bonuses; - } + public List getBonuses() { + return bonuses; + } - public void setBonuses(List bonuses) { - this.bonuses = bonuses; - } + public void setBonuses(List bonuses) { + this.bonuses = bonuses; + } - public String getUpdateBonusId() { - return updateBonusId; - } + public String getUpdateBonusId() { + return updateBonusId; + } - public void setUpdateBonusId(String updateBonusId) { - this.updateBonusId = updateBonusId; - } + public void setUpdateBonusId(String updateBonusId) { + this.updateBonusId = updateBonusId; + } } diff --git a/apc-web/src/main/resources/com/arrebol/apc/i18n/app.properties b/apc-web/src/main/resources/com/arrebol/apc/i18n/app.properties index 5c26c6b..e86ff5f 100644 --- a/apc-web/src/main/resources/com/arrebol/apc/i18n/app.properties +++ b/apc-web/src/main/resources/com/arrebol/apc/i18n/app.properties @@ -129,7 +129,7 @@ catalog.routes.datatable.empty=No hay rutas para mostrar catalog.routes.datatable.column.name=Nombre catalog.routes.dialog.title=Rutas catalog.routes.dialog.require.msg.color.empty=El nombre de la ruta es obligatorio -catalog.loanTypes.datatable.empty=No hay tipos de pr\u00e9stamo para mostrar +catalog.loanTypes.datatable.empty=No hay tipos de compra de producto para mostrar catalog.loanTypes.datatable.column.name=Nombre catalog.loanTypes.datatable.column.totalDays=Total d\u00edas catalog.loanTypes.datatable.column.fee=Multa @@ -141,7 +141,7 @@ catalog.loanTypes.dialog.name.require.msg.empty=El nombre es obligatorio catalog.loanTypes.dialog.name.title=Nombre catalog.loanTypes.dialog.totalDays.require.msg.empty=El total de d\u00edas es obligatorio catalog.loanTypes.dialog.totalDays.title=Total de d\u00edas -catalog.loanTypes.dialog.payment.require.msg.empty=El valor del pr\u00e9stamo es obligatorio +catalog.loanTypes.dialog.payment.require.msg.empty=El valor de la compra de producto es obligatorio catalog.loanTypes.dialog.payment.title=Precio catalog.loanTypes.dialog.fee.require.msg.empty=El valor de la multa es obligatorio catalog.loanTypes.dialog.fee.title=Multa @@ -168,7 +168,7 @@ admin.loan=Ventas admin.loan.to.approve=Por autorizar admin.loan.history=Historial admin.loan.historyJuridical=Historial jur\u00eddico -admin.loan.detail.title=Detalle del pr\u00e9stamo +admin.loan.detail.title=Detalle del compra de producto admin.financial=Financiero admin.financial.transfer=Transferencias admin.financial.moneyDaily=Inicios @@ -181,7 +181,7 @@ admin.payroll.bonus=Bonos admin.payroll.advance=Adelantos admin.payroll.create=Crear n\u00f3mina admin.payroll.history=Historial n\u00f3mina -admin.payroll.loanemployee=Pr\u00e9stamos +admin.payroll.loanemployee=Compra de producto admin.stats.fees=Multas admin.stats.closingday=Corte caja chica admin.stats.openingfee=Comisi\u00f3n por apertura @@ -213,7 +213,7 @@ admin.customers.datatable.column.peopleType=Tipo admin.customers.datatable.column.office=Sucursal admin.customers.detail.title=Detalle del cliente admin.customers.company.title=Informaci\u00f3n del negocio -admin.customers.loan.title=Historial de pr\u00e9stamos +admin.customers.loan.title=Historial de compra de productos admin.customers.detail.field.name=Nombre admin.customers.detail.field.firstName=Primer nombre admin.customers.detail.field.secondName=Segundo nombre @@ -227,7 +227,7 @@ admin.customers.detail.field.routeCtlg=Ruta admin.customers.detail.field.companyName=Nombre del negocio admin.customers.detail.field.phoneBusiness=Tel\u00e9fono del negocio admin.customers.detail.field.addressBusiness=Direcci\u00f3n del negocio -admin.customers.detail.datatable.empty=No hay pr\u00e9stamos por mostrar +admin.customers.detail.datatable.empty=No hay compras de productos por mostrar admin.customers.detail.datatable.column.endorsement=Aval admin.customers.detail.datatable.column.loanStatus=Estatus admin.customers.detail.datatable.column.amountToPay=Monto a pagar @@ -244,7 +244,7 @@ admin.endorsements.datatable.column.routeCtlg=Ruta admin.endorsements.datatable.column.peopleType=Tipo admin.endorsements.detail.title=Detalle del aval admin.endorsements.company.title=Informaci\u00f3n del negocio -admin.endorsements.loan.title=Historial de pr\u00e9stamos como aval +admin.endorsements.loan.title=Historial de compras de productos como aval admin.endorsements.detail.field.name=Nombre admin.endorsements.detail.field.birthdate=Fecha de nacimiento admin.endorsements.detail.field.phoneHome=Tel\u00e9fono de casa @@ -254,7 +254,7 @@ admin.endorsements.detail.field.routeCtlg=Ruta admin.endorsements.detail.field.companyName=Nombre del negocio admin.endorsements.detail.field.phoneBusiness=Tel\u00e9fono del negocio admin.endorsements.detail.field.addressBusiness=Direcci\u00f3n del negocio -admin.endorsements.detail.datatable.empty=No hay pr\u00e9stamos por mostrar +admin.endorsements.detail.datatable.empty=No hay compras de productos por mostrar admin.endorsements.detail.datatable.column.customer=Cliente admin.endorsements.detail.datatable.column.loanStatus=Estatus admin.endorsements.detail.datatable.column.amountToPay=Monto a pagar @@ -285,7 +285,7 @@ admin.people.dialog.companyName.title=Nombre del negocio admin.people.form.birthdate.require.msg.empty=La fecha de nacimiento es obligatorio admin.people.dialog.birthdate.title=Fecha de nacimiento admin.people.form.route.require.msg.empty=La ruta es obligatoria -admin.loans.datatable.empty=No hay pr\u00e9stamos por mostrar. +admin.loans.datatable.empty=No hay compras de productos por mostrar. admin.loans.datatable.column.customer=Cliente admin.loans.datatable.column.routeCtlg=Ruta admin.loans.datatable.column.endorsement=Aval diff --git a/apc-web/src/main/resources/com/arrebol/apc/i18n/app_background.properties b/apc-web/src/main/resources/com/arrebol/apc/i18n/app_background.properties index d59dfe6..be771af 100644 --- a/apc-web/src/main/resources/com/arrebol/apc/i18n/app_background.properties +++ b/apc-web/src/main/resources/com/arrebol/apc/i18n/app_background.properties @@ -13,7 +13,7 @@ validators.password=Contrase\u00f1a no v\u00e1lida. validator.select.one.menu.invalid.option=Opci\u00f3n no v\u00e1lida. user=Usuario employee=Empleado -loanType=Tipo de pr\u00e9stamo +loanType=Tipo de compra de producto people=Persona prmssn.update.title=Actualizaci\u00f3n de Permisos prmssn.add.true=Se asignaron los permisos al usuario. diff --git a/apc-web/src/main/resources/com/arrebol/apc/i18n/app_permission.properties b/apc-web/src/main/resources/com/arrebol/apc/i18n/app_permission.properties index 847cd39..7f5a362 100644 --- a/apc-web/src/main/resources/com/arrebol/apc/i18n/app_permission.properties +++ b/apc-web/src/main/resources/com/arrebol/apc/i18n/app_permission.properties @@ -114,13 +114,13 @@ catalog.typeLoan.add=Crear producto catalog.typeLoan.add.description=Men\u00fa de productos. catalog.typeLoan.add.path=Cat\u00e1logo / Producto (crear) -catalog.typeLoan.updated=Editar tipo de pr\u00e9stamos -catalog.typeLoan.updated.description=Permite editar tipo de pr\u00e9stamos. -catalog.typeLoan.updated.path=Cat\u00e1logo / Tipo de pr\u00e9stamos (editar) +catalog.typeLoan.updated=Editar tipo de compra de producto +catalog.typeLoan.updated.description=Permite editar tipo de compra de producto. +catalog.typeLoan.updated.path=Cat\u00e1logo / Tipo de compra de producto (editar) -catalog.typeLoan.deleted=Eliminar tipo de pr\u00e9stamos -catalog.typeLoan.deleted.description=Permite eliminar tipo de pr\u00e9stamos. -catalog.typeLoan.deleted.path=Cat\u00e1logo / Tipo de pr\u00e9stamos (eliminar) +catalog.typeLoan.deleted=Eliminar tipo de compra de producto +catalog.typeLoan.deleted.description=Permite eliminar tipo de compra de producto. +catalog.typeLoan.deleted.path=Cat\u00e1logo / Tipo de compra de producto (eliminar) #Rutas catalog.route=Rutas catalog.route.description=Men\u00fa de rutas. @@ -170,29 +170,29 @@ admin.endorsement.deleted=Eliminar avales admin.endorsement.deleted.description=Permite eliminar avales. admin.endorsement.deleted.path=Administraci\u00f3n / Avales (eliminar) #Prestamos -admin.loan=Pr\u00e9stamos -admin.loan.description=Men\u00fa de pr\u00e9stamos. -admin.loan.path=Administraci\u00f3n / Pr\u00e9stamos +admin.loan=Compra de producto +admin.loan.description=Men\u00fa de compra de productos. +admin.loan.path=Administraci\u00f3n / Compra de producto -admin.loan.add=Crear pr\u00e9stamos -admin.loan.add.description=Men\u00fa de pr\u00e9stamos. -admin.loan.add.path=Administraci\u00f3n / Pr\u00e9stamos (crear) +admin.loan.add=Crear compra de producto +admin.loan.add.description=Men\u00fa de compra de producto. +admin.loan.add.path=Administraci\u00f3n / Compra de producto (crear) -admin.loan.updated=Editar pr\u00e9stamos -admin.loan.updated.description=Permite editar pr\u00e9stamos. -admin.loan.updated.path=Administraci\u00f3n / Pr\u00e9stamos (editar) +admin.loan.updated=Editar compra de producto +admin.loan.updated.description=Permite editar compras de producto. +admin.loan.updated.path=Administraci\u00f3n / Compra de producto (editar) -admin.loan.deleted=Eliminar pr\u00e9stamos -admin.loan.deleted.description=Permite eliminar pr\u00e9stamos. -admin.loan.deleted.path=Administraci\u00f3n / Pr\u00e9stamos (eliminar) +admin.loan.deleted=Eliminar compra de producto +admin.loan.deleted.description=Permite eliminar compras de producto. +admin.loan.deleted.path=Administraci\u00f3n / Compra de producto (eliminar) admin.loan.change.owner=Cambiar asesor admin.loan.change.owner.description=Submen\u00fa cambiar asesor. -admin.loan.change.owner.path=Administraci\u00f3n / Pr\u00e9stamos / Cambiar asesor +admin.loan.change.owner.path=Administraci\u00f3n / Compras de producto / Cambiar asesor -admin.loan.change.owner.update=Cambiar prestamo asesor -admin.loan.change.owner.update.description=Permite cambiar el prestamo de asesor origen para el asesor destino. -admin.loan.change.owner.update.path=Administraci\u00f3n / Pr\u00e9stamos / Cambiar asesor (bot\u00f3n cambiar asesor) +admin.loan.change.owner.update=Cambiar compra de producto asesor +admin.loan.change.owner.update.description=Permite cambiar la compra de producto de asesor origen para el asesor destino. +admin.loan.change.owner.update.path=Administraci\u00f3n / Compras de producto / Cambiar asesor (bot\u00f3n cambiar asesor) #Transferencias admin.transfer=Transferencias admin.transfer.description=Men\u00fa de transferencias. diff --git a/apc-web/src/main/webapp/WEB-INF/sidebar.xhtml b/apc-web/src/main/webapp/WEB-INF/sidebar.xhtml index 4e5a28c..472e0af 100644 --- a/apc-web/src/main/webapp/WEB-INF/sidebar.xhtml +++ b/apc-web/src/main/webapp/WEB-INF/sidebar.xhtml @@ -272,7 +272,7 @@ rendered="#{loginBean.isUserInRole('admin.stableGeneralBox')}"/> diff --git a/apc-web/src/main/webapp/app/admin/closingDay/index.xhtml b/apc-web/src/main/webapp/app/admin/closingDay/index.xhtml index 3a4266e..d9fed8f 100644 --- a/apc-web/src/main/webapp/app/admin/closingDay/index.xhtml +++ b/apc-web/src/main/webapp/app/admin/closingDay/index.xhtml @@ -174,7 +174,7 @@ autocomplete="off" disabled="true" > - + - + - + @@ -139,7 +139,7 @@ - +

- + diff --git a/apc-web/src/main/webapp/app/admin/customer/index_old.xhtml b/apc-web/src/main/webapp/app/admin/customer/index_old.xhtml index a2b1604..9519709 100644 --- a/apc-web/src/main/webapp/app/admin/customer/index_old.xhtml +++ b/apc-web/src/main/webapp/app/admin/customer/index_old.xhtml @@ -29,7 +29,7 @@ - + @@ -63,7 +63,7 @@ - + - @@ -113,7 +113,7 @@ - +

- + diff --git a/apc-web/src/main/webapp/app/admin/loan/detail.xhtml b/apc-web/src/main/webapp/app/admin/loan/detail.xhtml index 6203ee8..255c25c 100644 --- a/apc-web/src/main/webapp/app/admin/loan/detail.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/detail.xhtml @@ -451,7 +451,7 @@ - +
@@ -461,7 +461,7 @@ -

Préstamo

+

Compra de producto

@@ -555,7 +555,7 @@



-

Modificar el tipo de préstamo

+

Modificar el tipo de compra de producto

- + diff --git a/apc-web/src/main/webapp/app/admin/loan/drive.xhtml b/apc-web/src/main/webapp/app/admin/loan/drive.xhtml index 7864507..5f46f1f 100644 --- a/apc-web/src/main/webapp/app/admin/loan/drive.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/drive.xhtml @@ -500,7 +500,7 @@
-

Préstamos enviados a Cobranza

+

Compras de producto enviados a Cobranza

@@ -803,7 +803,7 @@ - + diff --git a/apc-web/src/main/webapp/app/admin/loan/driveDate.xhtml b/apc-web/src/main/webapp/app/admin/loan/driveDate.xhtml index dff0e42..f8c14e8 100644 --- a/apc-web/src/main/webapp/app/admin/loan/driveDate.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/driveDate.xhtml @@ -296,7 +296,7 @@ Cantidad Pagada Actual - Tipo de Prestamo + Tipo de Compra de producto Abono Diario Comisión por Apertura Cliente Nuevo @@ -681,7 +681,7 @@ -

Préstamos enviados a Cobranza

+

Compras de producto enviados a Cobranza

diff --git a/apc-web/src/main/webapp/app/admin/loan/driveLast.xhtml b/apc-web/src/main/webapp/app/admin/loan/driveLast.xhtml index ed72318..9363895 100644 --- a/apc-web/src/main/webapp/app/admin/loan/driveLast.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/driveLast.xhtml @@ -496,7 +496,7 @@ -

Préstamos enviados a Cobranza

+

Compras de producto enviados a Cobranza

@@ -799,7 +799,7 @@ - + diff --git a/apc-web/src/main/webapp/app/admin/loan/history.xhtml b/apc-web/src/main/webapp/app/admin/loan/history.xhtml index 14e5f8e..0e0b372 100644 --- a/apc-web/src/main/webapp/app/admin/loan/history.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/history.xhtml @@ -133,7 +133,7 @@ - + @@ -250,7 +250,7 @@ - +

- + requiredMessage="El tipo de compra de producto es obligatorio"> + diff --git a/apc-web/src/main/webapp/app/admin/loan/historyDetail.xhtml b/apc-web/src/main/webapp/app/admin/loan/historyDetail.xhtml index 536ecfe..cc3f707 100644 --- a/apc-web/src/main/webapp/app/admin/loan/historyDetail.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/historyDetail.xhtml @@ -437,7 +437,7 @@
- +
@@ -447,7 +447,7 @@ -

Préstamo

+

Compra de producto

diff --git a/apc-web/src/main/webapp/app/admin/loan/loanRenovationWeekly.xhtml b/apc-web/src/main/webapp/app/admin/loan/loanRenovationWeekly.xhtml index d2ac398..8dfeb63 100644 --- a/apc-web/src/main/webapp/app/admin/loan/loanRenovationWeekly.xhtml +++ b/apc-web/src/main/webapp/app/admin/loan/loanRenovationWeekly.xhtml @@ -64,7 +64,7 @@ - + diff --git a/apc-web/src/main/webapp/app/payroll/loanEmployee/index.xhtml b/apc-web/src/main/webapp/app/payroll/loanEmployee/index.xhtml index c6136de..71cfea7 100644 --- a/apc-web/src/main/webapp/app/payroll/loanEmployee/index.xhtml +++ b/apc-web/src/main/webapp/app/payroll/loanEmployee/index.xhtml @@ -5,7 +5,7 @@ xmlns:p="http://primefaces.org/ui" xmlns:fn="http://java.sun.com/jsp/jstl/functions" template="/WEB-INF/template.xhtml"> - Préstamos a empleados + Compras de producto a empleados @@ -13,14 +13,14 @@
  • #{grant['admin.name']}
  • /
  • -
  • Préstamos empleados
  • +
  • Compras de producto empleados
  • -

    Préstamos de empleados

    +

    Compras de producto de empleados

    @@ -54,7 +54,7 @@ /> - + - + @@ -175,7 +175,7 @@

    @@ -202,7 +202,7 @@ - +

    - +

    @@ -241,7 +241,7 @@ - +

    diff --git a/apc-web/src/main/webapp/dashboard.xhtml b/apc-web/src/main/webapp/dashboard.xhtml index 4d49c7e..2a21dff 100644 --- a/apc-web/src/main/webapp/dashboard.xhtml +++ b/apc-web/src/main/webapp/dashboard.xhtml @@ -126,7 +126,7 @@ - + @@ -246,6 +246,59 @@
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + @@ -355,7 +408,7 @@ filterMatchMode="contains" value="#{dashboardManager.loanTypeId}" id="userSearch4" required="true" - requiredMessage="El tipo de préstamo es obligatorio"> + requiredMessage="El tipo de compra de producto es obligatorio"> @@ -437,7 +490,7 @@ - +

    diff --git a/apc-web/src/main/webapp/loanDetail.xhtml b/apc-web/src/main/webapp/loanDetail.xhtml index 95c6450..612b41f 100644 --- a/apc-web/src/main/webapp/loanDetail.xhtml +++ b/apc-web/src/main/webapp/loanDetail.xhtml @@ -444,7 +444,7 @@
    - +
    @@ -454,7 +454,7 @@ -

    Préstamo

    +

    Compra de producto

    diff --git a/apc-web/src/main/webapp/loanDetailEndorsement.xhtml b/apc-web/src/main/webapp/loanDetailEndorsement.xhtml index c29797f..2665ce4 100644 --- a/apc-web/src/main/webapp/loanDetailEndorsement.xhtml +++ b/apc-web/src/main/webapp/loanDetailEndorsement.xhtml @@ -438,7 +438,7 @@
    - +
    @@ -448,7 +448,7 @@ -

    Préstamo

    +

    Compra de producto