0 Descuentos por pronto pago en facturas de Admin, 0 BUG de ProveedoresAbonar descuento masivo
This commit is contained in:
@@ -345,6 +345,7 @@
|
||||
<asp:CheckBox Text="Descuento" ID="chkaplicaDescuento" CssClass="md-checksd" runat="server" Checked="false" OnCheckedChanged="chkaplicaDescuento_CheckedChanged" AutoPostBack="true" Visible="false" />
|
||||
<asp:TextBox runat="server" ID="TxtDescuenoMasivo" ClientIDMode="Static" onkeyup="DescuenoMasivo(this)" Visible="false" Width="60px"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtDescuenoMasivo" FilterType="Custom" ValidChars="1234567890+" />
|
||||
<asp:CheckBox Text="Generar Remisión" ID="ChkGeneraRNC" CssClass="md-checksd" runat="server" Checked="false" Visible="false" />
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@@ -608,14 +609,27 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
var Facturas = '';
|
||||
var RNCAutocheck = true;
|
||||
|
||||
function FnSuma(t, txt, importe) {
|
||||
function FnSuma(t, txt, importe, idTxtDescuento) {
|
||||
var chkPesosBancos = $get("ChkPagarPesos");
|
||||
var chkDolaresBancos = $get("ChkPagarDolares");
|
||||
|
||||
if (t.checked) {
|
||||
|
||||
txt.value = FormatoNumero(importe, 2);
|
||||
|
||||
let txtDescuento = $("#" + idTxtDescuento)
|
||||
|
||||
if (typeof txtDescuento.val() === "string"){
|
||||
let descuentoValue = $("#" + idTxtDescuento).val().trim();
|
||||
if (descuentoValue.length > 0) {
|
||||
calculaDescuentoEscalonado(importe, idTxtDescuento, txt, t, 'El Importe no debe de exceder el saldo',1);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
txt.value = "";
|
||||
}
|
||||
@@ -644,46 +658,50 @@
|
||||
if (textBoxes[i].id.indexOf('C_GvCxP_TxtAbonar') >= 0) {
|
||||
if (textBoxes[i].value != '') {
|
||||
idd = textBoxes[i].id.replace('C_GvCxP_TxtAbonar_', '');
|
||||
Facturas = Facturas + (Importe == 0 ? '' : ', ') + $get("C_GvCxP_HplF_" + idd).innerText;
|
||||
let importeFactura = 0;
|
||||
let chk = $('#C_GvCxP_Chk_'+idd) //C_GvCxP_Chk_
|
||||
|
||||
if(chk.is(':checked')){
|
||||
Facturas = Facturas + (Importe == 0 ? '' : ', ') + $get("C_GvCxP_HplF_" + idd).innerText;
|
||||
|
||||
let importeFactura = 0;
|
||||
|
||||
if (cveMonedaPago == 0) {
|
||||
if (aplicaTC && $get('TxtTC') != null) {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
} else {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
}
|
||||
} else {
|
||||
let cveMonedaCompra = textBoxes[i].getAttribute("cvemoneda");
|
||||
if (cveMonedaPago == 0) {
|
||||
if (aplicaTC && $get('TxtTC') != null) {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
} else {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
}
|
||||
} else {
|
||||
let cveMonedaCompra = textBoxes[i].getAttribute("cvemoneda");
|
||||
|
||||
switch (cveMonedaPago) {
|
||||
case 1: //PAGO CON PESOS
|
||||
switch (cveMonedaPago) {
|
||||
case 1: //PAGO CON PESOS
|
||||
|
||||
//SI SON DOLARES MULTIPLICAR POR TC
|
||||
if (cveMonedaCompra == '2') {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
//MISMA MONEDA DEBE SOLO SUMAR
|
||||
} else if (cveMonedaCompra == '1') {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
}
|
||||
|
||||
break;
|
||||
case 2: //PAGO CON DOLARES
|
||||
|
||||
//SI SON DOLARES MULTIPLICAR POR TC
|
||||
if (cveMonedaCompra == '2') {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
//MISMA MONEDA DEBE SOLO SUMAR
|
||||
} else if (cveMonedaCompra == '1') {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
}
|
||||
|
||||
break;
|
||||
case 2: //PAGO CON DOLARES
|
||||
|
||||
//MISMA MONEDA DEBE SOLO SUMAR
|
||||
if (cveMonedaCompra == '2') {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
//SI SON PESOS DIVIDIR ENTRE EL TC
|
||||
} else if (cveMonedaCompra == '1') {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) / parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
}
|
||||
break;
|
||||
if (cveMonedaCompra == '2') {
|
||||
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
|
||||
//SI SON PESOS DIVIDIR ENTRE EL TC
|
||||
} else if (cveMonedaCompra == '1') {
|
||||
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) / parseFloat($get('TxtTC').value), 2).split(',').join(''));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Importe = parseFloat(Importe) + importeFactura;
|
||||
Importe = parseFloat(Importe) + importeFactura;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (textBoxes[i].id.indexOf('C_GvCxP_TxtComision') >= 0) {
|
||||
@@ -714,12 +732,14 @@
|
||||
}
|
||||
|
||||
function FnCambia(chk, txt, saldo, op, text, Tipo) {
|
||||
debugger;
|
||||
|
||||
var chkPesosBancos = $get("ChkPagarPesos");
|
||||
var chkDolaresBancos = $get("ChkPagarDolares");
|
||||
if (op == 1) {
|
||||
if (txt.value != '') {
|
||||
chk.checked = true;
|
||||
if( RNCAutocheck){
|
||||
chk.checked = true;
|
||||
}
|
||||
} else {
|
||||
chk.checked = false;
|
||||
}
|
||||
@@ -831,7 +851,7 @@
|
||||
|
||||
var TipoCambioActual = 0.0;
|
||||
function CambiaTC(txt) {
|
||||
debugger;
|
||||
|
||||
//let TipoCambioTxt = ToDouble(txt.value)
|
||||
//if (TipoCambioActual != TipoCambioTxt) {
|
||||
$get("BtnCambiaTipoMoneda").click();
|
||||
@@ -839,8 +859,8 @@
|
||||
//}
|
||||
}
|
||||
|
||||
function calculaDescuentoEscalonado(saldo, TxtDescuento, TxtAbonar, chk, Text, Tipo) {
|
||||
let idTxtDescuento = TxtDescuento.id;
|
||||
function calculaDescuentoEscalonado(saldo, idTxtDescuento, TxtAbonar, chk, Text, Tipo) {
|
||||
//let idTxtDescuento = TxtDescuento.id;
|
||||
let idTxtAbonar = TxtAbonar.id;
|
||||
|
||||
let descuentoValue = $("#" + idTxtDescuento).val().trim();
|
||||
@@ -870,6 +890,8 @@
|
||||
|
||||
|
||||
function DescuenoMasivo(txt) {
|
||||
|
||||
RNCAutocheck = false;
|
||||
$(".selDescuento").val(txt.value);
|
||||
$(".selDescuento").trigger("keyup");
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(10).HorizontalAlign = HorizontalAlign.Right
|
||||
|
||||
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo")))
|
||||
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format(" RNCAutocheck = true; FnSuma(this,{0},{1},'{2}');", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCTextBox("TxtDescuento").ClientID))
|
||||
|
||||
If FiltrarCuentas = 1 AndAlso e.Row.RowIndex = 0 Then
|
||||
e.Row.FCHyperLink("HplF").Text = (CType(GvCxP.DataSource, DataTable).Rows.Count - 1).ToString
|
||||
@@ -522,8 +522,8 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
e.Row.FCCheckBox("Chk").Visible = False
|
||||
e.Row.FCTextBox("TxtComision").Visible = False
|
||||
Else
|
||||
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
||||
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},2,'{2}',2);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
||||
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format(" RNCAutocheck = true; FnCambia({0},this,{1},1,'{2}',1);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
||||
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format(" RNCAutocheck = true;FnCambia({0},this,{1},2,'{2}',2);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(7).ForeColor = Drawing.Color.Red
|
||||
@@ -586,7 +586,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
|
||||
e.Row.FCLiteral("LtlAux").Text = String.Format("<a Class=""Texto thickbox"" href=""/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxPProveedor&CveProveedor={0}&CveCompra={1}&TB_iframe=true&height=370&width=900"" />Ir</a>", e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveCompra"))
|
||||
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);{3}", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", FiltroInv))
|
||||
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format(" RNCAutocheck = true; FnCambia({0},this,{1},1,'{2}',1);{3}", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", FiltroInv))
|
||||
|
||||
|
||||
|
||||
@@ -623,7 +623,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
e.Row.FCCheckBox("Chk").Enabled = False
|
||||
End If
|
||||
|
||||
e.Row.FCTextBox("TxtDescuento").Attributes.Add("onkeyup", $"calculaDescuentoEscalonado({e.Row.DBCampo("Saldo")},{e.Row.FCTextBox("TxtDescuento").ClientID},{e.Row.FCTextBox("TxtAbonar").ClientID},{e.Row.FCCheckBox("Chk").ClientID},'El Importe no debe de exceder el saldo',1)")
|
||||
e.Row.FCTextBox("TxtDescuento").Attributes.Add("onkeyup", $" calculaDescuentoEscalonado({e.Row.DBCampo("Saldo")},'{e.Row.FCTextBox("TxtDescuento").ClientID}',{e.Row.FCTextBox("TxtAbonar").ClientID},{e.Row.FCCheckBox("Chk").ClientID},'El Importe no debe de exceder el saldo',1)")
|
||||
Else
|
||||
e.Row.FCTextBox("TxtDescuento").Visible = False
|
||||
|
||||
@@ -932,62 +932,81 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
|
||||
'INICIO Descuento Remision Nota de credito
|
||||
Dim descuentoParts As String() = gvr.FCTextBox("TxtDescuento").Text.Split("+"c)
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim TotalTemp As Decimal = gvr.DataKey("Saldo").ToDecimal
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(574) = "1" And ChkGeneraRNC.Checked Then
|
||||
Dim descuentoParts As String() = gvr.FCTextBox("TxtDescuento").Text.Split("+"c)
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim TotalTemp As Decimal = gvr.DataKey("Saldo").ToDecimal
|
||||
|
||||
If descuentoParts.Length = 0 Then
|
||||
Descuento = 0
|
||||
Else
|
||||
If descuentoParts.Length = 0 Then
|
||||
Descuento = 0
|
||||
Else
|
||||
|
||||
For i As Integer = 0 To descuentoParts.Length - 1
|
||||
Dim descuentoPart As Decimal = descuentoParts(i).Trim().ToDecimal
|
||||
If descuentoPart > 0 Then
|
||||
Descuento = Descuento + ((TotalTemp - Descuento) * (descuentoPart / 100))
|
||||
Else
|
||||
Continue For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
If Descuento > 0 Then
|
||||
|
||||
Dim PorcentajeIVA As Decimal = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||
Dim serieFolioArray As String() = gvr.DataKey("SerieFolio").ToString.Split("-"c)
|
||||
Dim SerieRNC As String = ""
|
||||
Dim FolioRNC As String = ""
|
||||
|
||||
Dim SerieFolioRNC As String = serieFolioArray(0)
|
||||
If serieFolioArray.Length = 2 Then
|
||||
SerieRNC = serieFolioArray(0)
|
||||
FolioRNC = serieFolioArray(1)
|
||||
SerieFolioRNC = $"{FolioRNC}-D-{SerieRNC = serieFolioArray(0)}"
|
||||
|
||||
For i As Integer = 0 To descuentoParts.Length - 1
|
||||
Dim descuentoPart As Decimal = descuentoParts(i).Trim().ToDecimal
|
||||
If descuentoPart > 0 Then
|
||||
Descuento = Descuento + ((TotalTemp - Descuento) * (descuentoPart / 100))
|
||||
Else
|
||||
Continue For
|
||||
FolioRNC = serieFolioArray(0)
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
Descuento = Descuento.RoundSQL(2)
|
||||
If PorcentajeIVA > 0 Then
|
||||
|
||||
If Descuento > 0 Then
|
||||
Descuento = ((Descuento) / (1 + PorcentajeIVA))
|
||||
'Descuento = ((Descuento) / (1 + PorcentajeIVA)).RoundSQL(2)
|
||||
|
||||
Dim PorcentajeIVA As Decimal = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||
Dim serieFolioArray As String() = gvr.DataKey("SerieFolio").ToString.Split("-"c)
|
||||
Dim SerieRNC As String = ""
|
||||
Dim FolioRNC As String = ""
|
||||
Dim saldo As Decimal = gvr.DataKey("Saldo").ToDecimal
|
||||
Dim abonado As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||
Dim TotalRNC = Descuento + (Descuento * PorcentajeIVA).RoundSQL
|
||||
Dim dif As Decimal = saldo - (TotalRNC + abonado)
|
||||
|
||||
Dim SerieFolioRNC As String = serieFolioArray(0)
|
||||
If serieFolioArray.Length = 2 Then
|
||||
SerieRNC = serieFolioArray(0)
|
||||
FolioRNC = serieFolioArray(1)
|
||||
SerieFolioRNC = $"{FolioRNC}-D-{SerieRNC = serieFolioArray(0)}"
|
||||
If dif.Abs() >= 0.01 Then
|
||||
If dif > 0 Then
|
||||
'Descuento = Descuento + 0.01D
|
||||
End If
|
||||
|
||||
Else
|
||||
FolioRNC = serieFolioArray(0)
|
||||
End If
|
||||
If dif < 0 Then
|
||||
'Descuento = Descuento - 0.01D
|
||||
End If
|
||||
End If
|
||||
|
||||
Descuento = Descuento.RoundSQL(2)
|
||||
If PorcentajeIVA > 0 Then
|
||||
Descuento = (Descuento) / (1 + PorcentajeIVA)
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim CveCompraRNC As Integer = GeneraRNC(Descuento.RoundSQL(2), ObjComp.IniciaTransacSQL, gvr.DataKey("CveCompra").ToEntero, CompraActual, ObjMov, CvePrePoliza, CveProveedor, HplProveedor.Text, TxtFechaDocumento.Text.ToDate,
|
||||
$"Remisión Nota de Crédito pago {gvr.DataKey("SerieFolio").ToString}", gvr.DataKey("CveMoneda").ToEntero, TxtTC.Text.ToDecimal, SerieRNC, FolioRNC, PorcentajeIVA:=PorcentajeIVA,
|
||||
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero)
|
||||
Dim CveCompraRNC As Integer = GeneraRNC(Descuento, ObjComp.IniciaTransacSQL, gvr.DataKey("CveCompra").ToEntero, CompraActual, ObjMov, CvePrePoliza, CveProveedor, HplProveedor.Text, TxtFechaDocumento.Text.ToDate,
|
||||
$"Remisión Nota de Crédito pago {gvr.DataKey("SerieFolio").ToString}", gvr.DataKey("CveMoneda").ToEntero, TxtTC.Text.ToDecimal, SerieRNC, FolioRNC, PorcentajeIVA:=PorcentajeIVA,
|
||||
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero)
|
||||
|
||||
If CveCompraRNC > 0 Then
|
||||
If CveCompraRNC > 0 Then
|
||||
|
||||
sbRNC.AppendLine($"<a class='Texto' href='../Compras/Compras.aspx?CveCompra={CveCompraRNC}' > {SerieFolioRNC}</a><br>")
|
||||
sbRNC.AppendLine($"<a class='Texto' href='../Compras/Compras.aspx?CveCompra={CveCompraRNC}' > {SerieFolioRNC}</a><br>")
|
||||
|
||||
Else
|
||||
'TieneError = True
|
||||
MsgError = $"Error al Generar Remisión de Nota de Crédito de factura {gvr.DataKey("SerieFolio").ToString}"
|
||||
Exit For
|
||||
Else
|
||||
'TieneError = True
|
||||
MsgError = $"Error al Generar Remisión de Nota de Crédito de factura {gvr.DataKey("SerieFolio").ToString}"
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'FIN Descuento Remision Nota de credito
|
||||
|
||||
|
||||
@@ -1855,6 +1874,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked
|
||||
TxtDescuenoMasivo.Visible = chkaplicaDescuento.Checked
|
||||
ChkGeneraRNC.Visible = chkaplicaDescuento.Checked
|
||||
UPCompras.Update()
|
||||
End Sub
|
||||
|
||||
@@ -1986,12 +2006,14 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
Dim PS As String = PSRow("PSCodigo").ToString
|
||||
Dim CveUM As Integer = PSRow("CveUnidadMedida").ToString.ToEntero
|
||||
Dim UM As String = PSRow("UnidadMedida").ToString
|
||||
Dim IVARNC As Decimal = (ImporteRNC * PorcentajeIVA)
|
||||
|
||||
CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC, IVARNC, (ImporteRNC + IVARNC), PorcentajeIVA)
|
||||
Dim IVARNC As Decimal = (ImporteRNC * PorcentajeIVA).RoundSQL(2)
|
||||
Dim TotalRNC As Decimal = (ImporteRNC + IVARNC).RoundSQL(2)
|
||||
|
||||
CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC.RoundSQL(2), IVARNC, TotalRNC, PorcentajeIVA)
|
||||
|
||||
If CompraRNC.AddCompra(sqltransaccion) Then
|
||||
Dim tImporteRNC = ImporteRNC + IVARNC ' le agrego el importe del iva
|
||||
Dim tImporteRNC = (ImporteRNC + IVARNC).RoundSQL(2) ' le agrego el importe del iva
|
||||
Dim Pago As New CompraPago
|
||||
Pago.ImportePago = tImporteRNC
|
||||
Pago.CveMonedaPago = CompraActual.CveMoneda
|
||||
@@ -2003,6 +2025,10 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
Pago.Fecha = CompraActual.Fecha 'toma la misma fecha de la provisión en el pago de NC
|
||||
CveCompraRNC = CompraRNC.CveCompra
|
||||
respuesta = Not AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta)
|
||||
|
||||
If Not respuesta Then
|
||||
Dim error_ As Boolean = True
|
||||
End If
|
||||
Else
|
||||
respuesta = False
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user