- REGISTRO DE INGRESOS (MOSTRAR EN COLOR GRIS CLARO LOS REGISTROS DESHABILITADOS)

This commit is contained in:
Brayan.Gonzalez 2025-05-07 18:45:14 -06:00
parent 1fbca6e5ff
commit a266bf4f68
6 changed files with 1794 additions and 1637 deletions

View File

@ -5,26 +5,31 @@ package com.arrebol.taxiservicios.model.enums;
* @author Picasso
*/
public enum ExpenseStatusType {
PENDING("Pendiente") {
@Override
public String toString() {
return "PENDING";
}
}, AUTHORIZED("Autorizado") {
@Override
public String toString() {
return "AUTHORIZED";
}
};
PENDING("Pendiente") {
@Override
public String toString() {
return "PENDING";
}
}, AUTHORIZED("Autorizado") {
@Override
public String toString() {
return "AUTHORIZED";
}
}, DISABLED("Deshabilitada") {
@Override
public String toString() {
return "DISABLED";
}
};
private final String status;
private final String status;
private ExpenseStatusType(String status) {
this.status = status;
}
private ExpenseStatusType(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public String getStatus() {
return status;
}
}

View File

@ -672,7 +672,14 @@ public class AddClosingDayBean extends TaxiGenericBean implements Serializable {
private final String sub_query_to_find_previously_closing_day = "(SELECT DATE(cd.created_on) FROM closing_day cd WHERE DATE(cd.created_on) <= CURDATE() AND cd.user_id = :userID AND cd.active_status = 'ENEBLED' order by cd.created_on DESC LIMIT 1)";
private final String query_total_inicio_expenses = "SELECT IF(ISNULL(SUM(payment)),0, SUM(payment)) AS total_expenses FROM expense LEFT JOIN expense_income_catalog ON expense.id_expense_type = expense_income_catalog.id WHERE DATE(expense.created_on) > " + sub_query_to_find_previously_closing_day + " AND expense_status_type = 'AUTHORIZED' AND expense.created_by = :userID AND (expense_type IN ('INICIO','ABONO_FINANCIAMIENTO','PAGO_ORDEN_SERVICIO') OR (expense_income_catalog.type = 'EARNING')) AND id_bank_card is null";
private final String query_total_expenses = "SELECT IF(ISNULL(SUM(payment)),0, SUM(payment)) AS total_expenses FROM expense INNER JOIN expense_income_catalog ON expense.id_expense_type = expense_income_catalog.id WHERE DATE(expense.created_on)> " + sub_query_to_find_previously_closing_day + " AND expense_status_type = 'AUTHORIZED' AND expense.created_by = :userID AND expense_income_catalog.type = 'EXPENSE' AND id_bank_card is null";
private final String query_total_expenses = "SELECT IF(ISNULL(SUM(payment)),0, SUM(payment)) AS total_expenses "
+ "FROM expense "
+ "INNER JOIN expense_income_catalog ON expense.id_expense_type = expense_income_catalog.id "
+ "WHERE DATE(expense.created_on)> " + sub_query_to_find_previously_closing_day + " "
+ "AND expense_status_type = 'AUTHORIZED' "
+ "AND expense.created_by = :userID "
+ "AND expense_income_catalog.type = 'EXPENSE' "
+ "AND id_bank_card is null";
private final String query_total_transfer_send = "SELECT IF(ISNULL(SUM(amount_to_transfer)),0, SUM(amount_to_transfer)) AS total_transfer_send FROM transfer_car_driver WHERE DATE(created_on) > " + sub_query_to_find_previously_closing_day + " AND action_status = 'APPROVED' AND active_status = 'ENEBLED' AND id_user_transmitter = :userID";
private final String query_total_transfer_receiver = "SELECT IF(ISNULL(SUM(amount_to_transfer)),0, SUM(amount_to_transfer)) AS total_transfer_receiver FROM transfer_car_driver WHERE DATE(created_on) > " + sub_query_to_find_previously_closing_day + " AND action_status = 'APPROVED' AND active_status = 'ENEBLED' AND id_user_receiver = :userID";

View File

@ -273,6 +273,12 @@ expense.delete.title=Eliminaci\u00f3n de gasto
expense.delete.success.desc=Se elimin\u00f3 el gasto correctamente.
expense.delete.fail.desc=No se pudo eliminar el gasto.
expense.delete.exception.desc=Ocurrio un error al eliminar el gasto.
expense.disable.title=Deshabilitar de gasto
expense.disable.success.desc=Se deshabilito el gasto correctamente.
expense.disable.fail.desc=No se pudo deshabilitar el gasto.
expense.disable.exception.desc=Ocurrio un error al deshabilitar el gasto.
expense.autorizar.title=Autorizar gasto
expense.autorizar.success.desc=Se autoriz\u00f3 el gasto correctamente.
expense.autorizar.fail.desc=No se pudo autorizar el gasto.

View File

@ -10,6 +10,17 @@
<h:outputScript library="js" name="admin/expense.js" />
<h:outputScript library="js" name="bitacora/bitacora.js" />
<h:outputScript library="js" name="bitacora/bitacora.de.ventas.gastos.e.inicios.js" />
<style>
.bgGray {
background-color: gray !important;
color: black;
}
.bgWhite {
background-color:white !important;
color: black;
}
</style>
</ui:define>
<ui:define name="title">#{i18n.project} - #{grant['admin.sale.name']}</ui:define>
@ -69,11 +80,11 @@
rowsPerPageTemplate="5,10,25,50,100"
emptyMessage="#{i18n['menu.admin.expense.datatable.empty']}"
rowKey="#{expense.id}"
rowStyleClass="#{expense.status eq 'PENDING' ? 'datatableRowLittle' : null}"
selection="#{managerExpense.selectedExpense}"
editable="true" selectionMode="single"
paginator="true" rows="10"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}">
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowStyleClass="#{managerExpense.validarColorPagoPoliza(expense.status)}">
<f:facet name="header">
<div style="float:right;padding-top: 5px;display: block;">
@ -82,7 +93,7 @@
<p:dataExporter type="xls" target="dtExpenseDtb" fileName="ingresos-egresos" />
</h:commandLink>
</div>
<p:commandButton id="toggler" type="button" value="Columnas" style="float:left;" styleClass="amber-btn flat" icon="ui-icon-calendar"/>
<p:columnToggler datasource="dtExpenseDtb" trigger="toggler" />
<p:commandButton type="button"
@ -117,6 +128,11 @@
filterBy="#{expense.idExpenseType != null and not empty expense.idExpenseType ? expense.idExpenseType.name : ''}">
<h:outputText value="#{expense.idExpenseType != null and not empty expense.idExpenseType ? expense.idExpenseType.name : ''}" />
</p:column>
<p:column headerText="Estatus" sortBy="#{expense.status.status}" filterBy="#{expense.status.status}">
<h:outputText value="#{expense.status.status}" />
</p:column>
<p:column headerText="#{i18n['menu.admin.expense.column.description']}" sortBy="#{expense.description}" filterBy="#{expense.description}">
<h:outputText value="#{expense.description}" />
</p:column>
@ -130,14 +146,31 @@
class="ui-button-icon-only red-btn"
title="Eliminar"
id="ctxMenuItem3"
rendered="#{loginBean.isUserInRole('admin.income.expenses.delete') and expense.getAction(managerExpense.lastStableSmallBox) and !managerExpense.hayCuadreSmall}"
rendered="#{loginBean.isUserInRole('admin.income.expenses.delete') and expense.getAction(managerExpense.lastStableSmallBox)
and !managerExpense.hayCuadreSmall
and expense.status eq 'AUTHORIZED'}"
update="confirmForm:globalConfirmMsg"
onclick="PF('deleteEventBitacoraIngresoEgreso').show();">
<f:setPropertyActionListener value="#{expense}" target="#{managerExpense.selectedExpense}" />
<p:confirm message="¿Estas seguro de querer borrar el ingreso/egreso?"
header="Eliminar Ingreso/Egreso"
icon="ui-icon-delete"/>
</p:commandButton>
<p:commandButton
icon="ui-icon-minusthick"
class="ui-button-icon-only red-btn"
title="Deshabilitar"
id="ctxMenuItem4"
rendered="#{loginBean.isUserInRole('admin.income.expenses.delete') and expense.getAction(managerExpense.lastStableSmallBox)
and !managerExpense.hayCuadreSmall
and expense.status eq 'AUTHORIZED'}"
update="confirmForm:globalConfirmMsg"
onclick="PF('disabledEventBitacoraIngresoEgreso').show();">
<f:setPropertyActionListener value="#{expense}" target="#{managerExpense.selectedExpense}" />
<p:confirm message="¿Estas seguro de querer deshabilitar el ingreso/egreso?"
header="Deshabilitar Ingreso/Egreso"
icon="ui-icon-delete"/>
</p:commandButton>
</p:column>
@ -175,6 +208,35 @@
</p:dialog>
</h:form>
<h:form id="bitacoraFormDisableIngresoEgreso" rendered="#{loginBean.isUserInRole('admin.income.expenses.delete')}">
<p:growl id="msgsDialogBitacoraDisableIngresoEgreso" showDetail="true"/>
<p:dialog widgetVar="disabledEventBitacoraIngresoEgreso" width="30%"
id="disabledEventBitacoraIngresoEgreso"
header="Deshabilitar Ingreso/Egreso"
modal="true" responsive="true"
showEffect="clip" hideEffect="clip">
<br></br>
<h:panelGroup styleClass="md-inputfield" >
<p:inputText id="commentsBitacora"
value="#{managerExpense.commentsBitacora}"
autocomplete="off" style="width: 100%;">
</p:inputText>
<label>Comentarios</label>
<p:message for="commentsBitacora" display="text"/>
</h:panelGroup>
<br></br>
<div class="ui-g-12">
<p:commandButton id="addButtonBitacora"
value="#{i18n['button.save']}"
actionListener="#{managerExpense.disableRow()}"
oncomplete="disabledEventBitacoraIngresoEgreso(xhr, status, args)"
update="formExpense:dtExpenseDtb
msgsDialogBitacoraDisableIngresoEgreso
disabledEventBitacoraIngresoEgreso"/>
</div>
</p:dialog>
</h:form>
<h:form id="expenseForm" rendered="#{loginBean.isUserInRole('admin.income.expenses.add')}">
<p:growl id="msgsDialog" showDetail="true"/>
<p:dialog widgetVar="expenseDialogPopup" width="30%" id="expenseDialogPopup"
@ -185,7 +247,7 @@
<h:panelGroup id="transferFeePnlGrpFee" styleClass="md-inputfield">
<p:selectBooleanCheckbox id="transferFee" style="width: 100%"
itemLabel="Depósito"
value="#{managerExpense.deposit}">
<p:ajax update="bankFeePnlGrp"/>
</p:selectBooleanCheckbox>
@ -239,7 +301,7 @@
</h:panelGroup>
</div>
<br></br>
<br></br>
<h:panelGroup styleClass="md-inputfield" >
<p:inputText id="description" value="#{managerExpense.addExpense.description}" autocomplete="off" style="width: 100%;">
@ -248,7 +310,7 @@
<p:message for="description" display="text"/>
</h:panelGroup>
<br></br>
<div class="ui-g-12">
<p:commandButton id="addButton"
value="#{i18n['button.save']}"