-- devolución de izettle, con numeros negativos

This commit is contained in:
2022-02-09 15:36:25 -07:00
parent e81ef2fe74
commit 0bd4ac8074
2 changed files with 75 additions and 67 deletions

View File

@@ -416,13 +416,19 @@
comisionNegativa = txtcomision * -1; comisionNegativa = txtcomision * -1;
} }
if (comisionNegativa > saldo) { if (comisionNegativa > saldo) {
$('#C_TxtComision').val(0);
comision = 0; //var opcion = confirm("El importe especificado es superior a lo seleccionado, está seguro?");
descuento = 0; //if (opcion != true) {
txtcomision = 0; // debugger;
alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado"); // $('#C_TxtComision').val(0);
saldo = 0; // comision = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); // descuento = 0;
// txtcomision = 0;
// //alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado");
// saldo = 0;
// $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
//}
} else { } else {
//debugger; //debugger;
@@ -509,14 +515,18 @@
if (comision2 < 0) { if (comision2 < 0) {
comisionNegativa = comision2 * -1; comisionNegativa = comision2 * -1;
} }
if (comisionNegativa > ValorTotalSeleccionado) { //if (comisionNegativa > ValorTotalSeleccionado) {
$('#C_TxtComision').val(0) // var opcion = confirm("El importe especificado es superior a lo seleccionado, está seguro?");
alert("No es posible poner una comision superior a lo seleccionado") // if (opcion != true) {
} else { // debugger;
// $('#C_TxtComision').val(0)
// // alert("No es posible poner una comision superior a lo seleccionado")
// }
//} else {
saldo = ValorTotalSeleccionado + comision2 + descuento - IVA - ComisionIntermediario; saldo = ValorTotalSeleccionado + comision2 + descuento - IVA - ComisionIntermediario;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
comision = ToDouble($('#C_TxtComision').val()) comision = ToDouble($('#C_TxtComision').val())
} //}
} }

View File

@@ -236,17 +236,21 @@ Partial Class Bancos_DepositosCaja
End If End If
End If End If
Dim CveTransaccionBanco As Integer = 13
If TotalImporte < 0 Then 'que es una devolución, entonces como es negativo, se cambia el concetpo de bancos, por condición de trigger
CveTransaccionBanco = 6
End If
'Entrada a bancos 'Entrada a bancos
FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 13) FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco)
If Not FolioIE > 0 Then If Not FolioIE > 0 Then
OcurrioError = True OcurrioError = True
End If End If
CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 13, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario) CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario)
documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a> &nbsp &nbsp <br/> ", CveIEOrigen, FolioIE) documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a> &nbsp &nbsp <br/> ", CveIEOrigen, FolioIE)
If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio) Then If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio) Then
If ChkFaltante.Checked Then If ChkFaltante.Checked Then
@@ -257,8 +261,6 @@ Partial Class Bancos_DepositosCaja
OcurrioError = True OcurrioError = True
End If End If
End If End If
End If End If
If ChkDescuento.Checked Then If ChkDescuento.Checked Then
@@ -270,66 +272,62 @@ Partial Class Bancos_DepositosCaja
End If End If
End If End If
Else Else
OcurrioError = True OcurrioError = True
End If End If
If Not OcurrioError Then
For Each Gvr As GridViewRow In GvFacturas.Rows
For Each Gvr As GridViewRow In GvFacturas.Rows If Gvr.FCCheckBox("ChkFactura").Checked Then
'Datos de las Nuevas PrePolizas
'Entrada a Bancos
If Gvr.FCCheckBox("ChkFactura").Checked Then Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal
'Datos de las Nuevas PrePolizas Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString
'Entrada a Bancos
Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal 'Datos de las Prepolizas A Cancelar
Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero
Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero
Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero
'Datos de las Prepolizas A Cancelar FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2)
Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero If Not FolioIE > 0 Then
Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero OcurrioError = True
Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero Exit For
End If
FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2) CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not FolioIE > 0 Then
OcurrioError = True
Exit For
End If
CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then
OcurrioError = True OcurrioError = True
Exit For Exit For
End If
'Asignamos la cuenta Deposito
If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then
OcurrioError = True
Exit For
End If
End If End If
'Asignamos la cuenta Deposito Next
If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then
OcurrioError = True
Exit For
End If
Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
End If documentos += String.Format("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", StrEncript, "Depósito Bancario")
Next End If
Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
documentos += String.Format("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", StrEncript, "Depósito Bancario")
If OcurrioError Then If OcurrioError Then
ObjContabilidad.RollBack() ObjContabilidad.RollBack()
Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError) Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError)
Else Else
ObjContabilidad.Commit() ObjContabilidad.Commit()
CargaDatos()
documentos += String.Format("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", NuevaCvePrePoliza) documentos += String.Format("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", NuevaCvePrePoliza)
Alert(documentos.ToString) Alert(documentos.ToString)
CargaDatos()
End If End If
TxtComision.Text = "" TxtComision.Text = ""