Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -381,6 +381,7 @@ Namespace Modelos
|
|||||||
Public Class MAnticipoRelacionado
|
Public Class MAnticipoRelacionado
|
||||||
Public Property CveVenta As Integer
|
Public Property CveVenta As Integer
|
||||||
Public Property FolioFiscal As String
|
Public Property FolioFiscal As String
|
||||||
|
Public Property Tipo As String
|
||||||
End Class
|
End Class
|
||||||
<Serializable>
|
<Serializable>
|
||||||
Public Class MVentaDetalleCotizacion
|
Public Class MVentaDetalleCotizacion
|
||||||
@@ -1119,7 +1120,7 @@ Namespace Modelos
|
|||||||
'MENSAJE PRINCIPAL
|
'MENSAJE PRINCIPAL
|
||||||
|
|
||||||
If MostrarURL Then
|
If MostrarURL Then
|
||||||
MensajeAlert.AppendFormat("<br/>La {0}: <a class=""Texto"" target=""_blank"" href=""/Ventas/Ventas.aspx?CveVenta={2}""><b></b>{1}</a> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio, Me.CveVenta)
|
MensajeAlert.AppendFormat("<br/>La {0}: <a class=""Texto"" target=""_blank"" href=""/Ventas/Ventas.aspx?CveVenta={2}""><b></b>{1}</a> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", If(Me.TipoDocumento = "Egresos", "Nota de crédito", Me.TipoDocumento)), Me.SerieFolio, Me.CveVenta)
|
||||||
Else
|
Else
|
||||||
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio))
|
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio))
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -393,7 +393,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="note note-success">
|
<div class="note note-success">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-1"><b>Nombre:</b></div>
|
<div class="col-md-2">
|
||||||
|
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
|
||||||
|
|
||||||
|
<b>Nombre:</b>
|
||||||
|
</div>
|
||||||
<div class="col-md-4"> <label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label> </div>
|
<div class="col-md-4"> <label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label> </div>
|
||||||
|
|
||||||
<div class="col-md-1"><b>Folio:</b></div>
|
<div class="col-md-1"><b>Folio:</b></div>
|
||||||
@@ -411,10 +415,6 @@
|
|||||||
<div class="col-md-1" style="text-align: right;">
|
<div class="col-md-1" style="text-align: right;">
|
||||||
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
|
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1" style="text-align: right;">
|
|
||||||
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1272,152 +1272,152 @@
|
|||||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||||
<script src="/Scripts/PrintJS/print.min.js"></script>
|
<script src="/Scripts/PrintJS/print.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//function impresionDirecta(urlPDF) {
|
//function impresionDirecta(urlPDF) {
|
||||||
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
|
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
|
||||||
//}
|
//}
|
||||||
|
|
||||||
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
||||||
let totalAnt = 0;
|
let totalAnt = 0;
|
||||||
|
|
||||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||||
|
|
||||||
//si es con.nc,es.el.total
|
//si es con.nc,es.el.total
|
||||||
let Total = ToDouble($get("C_LtlSaldo").value);
|
let Total = ToDouble($get("C_LtlSaldo").value);
|
||||||
|
|
||||||
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value).toFixed(2));
|
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value).toFixed(2));
|
||||||
|
|
||||||
if (t.checked) {
|
if (t.checked) {
|
||||||
|
|
||||||
if (SaldoCompra > 0) {
|
if (SaldoCompra > 0) {
|
||||||
|
|
||||||
if (AmorContrato > 0) {
|
|
||||||
txt.value = AmorContrato.toFixed(2);
|
|
||||||
} else {
|
|
||||||
txt.value = importe.toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
totalAnt = FnSumaValoresAnt();
|
|
||||||
|
|
||||||
if (totalAnt > SaldoCompra) {
|
|
||||||
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
|
|
||||||
//$get('HdnVentaSaldo').value = 0.00;
|
|
||||||
alert("El Importe no debe de exceder a el saldo");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (AmorContrato > 0) {
|
||||||
|
txt.value = AmorContrato.toFixed(2);
|
||||||
} else {
|
} else {
|
||||||
t.checked = false;
|
txt.value = importe.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalAnt = FnSumaValoresAnt();
|
||||||
|
|
||||||
|
if (totalAnt > SaldoCompra) {
|
||||||
|
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
|
||||||
|
//$get('HdnVentaSaldo').value = 0.00;
|
||||||
|
alert("El Importe no debe de exceder a el saldo");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
|
t.checked = false;
|
||||||
txt.value = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
|
} else {
|
||||||
|
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
|
||||||
|
txt.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
|
||||||
|
}
|
||||||
|
|
||||||
function FnCambiaAnt(chk, txt, saldo) {
|
|
||||||
|
|
||||||
let Total = ToDouble($get("C_LtlSaldo").value);// ToDouble($get('TxtSubTotal').value);
|
function FnCambiaAnt(chk, txt, saldo) {
|
||||||
|
|
||||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
let Total = ToDouble($get("C_LtlSaldo").value);// ToDouble($get('TxtSubTotal').value);
|
||||||
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
|
|
||||||
|
|
||||||
if (TipoAnticipo == '4') {
|
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||||
Total = ToDouble($get("C_LtlSaldo").value);
|
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
|
||||||
}
|
|
||||||
|
|
||||||
if (isNaN(importeTxt)) {
|
if (TipoAnticipo == '4') {
|
||||||
|
Total = ToDouble($get("C_LtlSaldo").value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(importeTxt)) {
|
||||||
|
importeTxt = 0;
|
||||||
|
} else {
|
||||||
|
if (importeTxt <= 0) {
|
||||||
importeTxt = 0;
|
importeTxt = 0;
|
||||||
} else {
|
|
||||||
if (importeTxt <= 0) {
|
|
||||||
importeTxt = 0;
|
|
||||||
chk.checked = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saldo = (importeTxt > saldo) ? saldo : importeTxt;
|
|
||||||
|
|
||||||
|
|
||||||
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
|
|
||||||
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
|
|
||||||
//minimo entre saldocompra y el saldoanticipo
|
|
||||||
if (SaldoCompra < saldo) saldo = SaldoCompra;
|
|
||||||
|
|
||||||
if (ToDouble(txt.value) > 0) {
|
|
||||||
chk.checked = true;
|
|
||||||
} else {
|
|
||||||
chk.checked = false;
|
chk.checked = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ToDouble(txt.value) > saldo) {
|
|
||||||
txt.value = saldo;
|
|
||||||
alert("El Importe no debe de exceder a el saldo");
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
|
|
||||||
|
|
||||||
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function FnSumaValoresAnt() {
|
saldo = (importeTxt > saldo) ? saldo : importeTxt;
|
||||||
let totalPoints = 0;
|
|
||||||
let t = '';
|
|
||||||
|
|
||||||
$('input[name*=TxtAnticipo]').each(function () {
|
|
||||||
totalPoints += ToDouble($(this).val());
|
|
||||||
});
|
|
||||||
|
|
||||||
return Math.round(totalPoints * 100) / 100;
|
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
|
||||||
|
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
|
||||||
|
//minimo entre saldocompra y el saldoanticipo
|
||||||
|
if (SaldoCompra < saldo) saldo = SaldoCompra;
|
||||||
|
|
||||||
|
if (ToDouble(txt.value) > 0) {
|
||||||
|
chk.checked = true;
|
||||||
|
} else {
|
||||||
|
chk.checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function impresionBase64(pdfBase64) {
|
if (ToDouble(txt.value) > saldo) {
|
||||||
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
|
txt.value = saldo;
|
||||||
|
alert("El Importe no debe de exceder a el saldo");
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculaTotalPagoContado() {
|
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
|
||||||
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
|
||||||
let totalCredito = ToDouble($get("TxtImporteCredito").value);
|
|
||||||
let totalDebito = ToDouble($get("TxtImporteDebito").value);
|
|
||||||
let totalCheque = ToDouble($get("TxtImporteCheque").value);
|
|
||||||
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
|
|
||||||
let TotalOtrosContado = 0;
|
|
||||||
|
|
||||||
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado;
|
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
|
||||||
|
}
|
||||||
|
|
||||||
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
function FnSumaValoresAnt() {
|
||||||
let totalAnticipos = ToDouble($get("TxtNCDev").value);
|
let totalPoints = 0;
|
||||||
total = total + totalAnticipos;
|
let t = '';
|
||||||
}
|
|
||||||
|
|
||||||
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
|
$('input[name*=TxtAnticipo]').each(function () {
|
||||||
|
totalPoints += ToDouble($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
if (total > totalVenta) {
|
return Math.round(totalPoints * 100) / 100;
|
||||||
lblCambio.innerHTML = "Cambio:";
|
}
|
||||||
//HdnCambioFaltante.value = "1";
|
|
||||||
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
|
|
||||||
} else {
|
|
||||||
lblCambio.innerHTML = "Faltante:";
|
|
||||||
//HdnCambioFaltante.value = "0";
|
|
||||||
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$get("TxtImporteContado").value = FormatoNumero(total, 2);
|
function impresionBase64(pdfBase64) {
|
||||||
|
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalculaTotalPagoContado() {
|
||||||
|
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
||||||
|
let totalCredito = ToDouble($get("TxtImporteCredito").value);
|
||||||
|
let totalDebito = ToDouble($get("TxtImporteDebito").value);
|
||||||
|
let totalCheque = ToDouble($get("TxtImporteCheque").value);
|
||||||
|
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
|
||||||
|
let TotalOtrosContado = 0;
|
||||||
|
|
||||||
|
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado;
|
||||||
|
|
||||||
|
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
||||||
|
let totalAnticipos = ToDouble($get("TxtNCDev").value);
|
||||||
|
total = total + totalAnticipos;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculaDiferencia() {
|
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
|
||||||
let total = 0;
|
|
||||||
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
|
if (total > totalVenta) {
|
||||||
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
|
lblCambio.innerHTML = "Cambio:";
|
||||||
|
//HdnCambioFaltante.value = "1";
|
||||||
|
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
|
||||||
|
} else {
|
||||||
|
lblCambio.innerHTML = "Faltante:";
|
||||||
|
//HdnCambioFaltante.value = "0";
|
||||||
|
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculaDiferenciaBloqueo() {
|
$get("TxtImporteContado").value = FormatoNumero(total, 2);
|
||||||
let total = 0;
|
}
|
||||||
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
|
|
||||||
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
function CalculaDiferencia() {
|
||||||
}
|
let total = 0;
|
||||||
|
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
|
||||||
|
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalculaDiferenciaBloqueo() {
|
||||||
|
let total = 0;
|
||||||
|
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
|
||||||
|
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
|
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
|
||||||
Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
|
Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
|
||||||
|
Dim RegistrarPago As Boolean = True
|
||||||
Try
|
Try
|
||||||
'FACTURAR LA REMISION PARA HACER EL PAGO
|
'FACTURAR LA REMISION PARA HACER EL PAGO
|
||||||
If UsuarioActual.CveEmpresa.Contiene(189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
|
If UsuarioActual.CveEmpresa.Contiene(189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
|
||||||
@@ -563,73 +563,78 @@ Partial Class Ventas_PVCobranza
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If MsgError = "" Then
|
If MsgError = "" Then
|
||||||
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 11, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
If SaldoPendiente > 0 Then
|
||||||
|
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 11, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||||
|
|
||||||
If CvePrePoliza > 0 Then
|
If CvePrePoliza > 0 Then
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
||||||
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||||
SaldoPendiente -= TxtImporteCredito.Text.ToDecimal
|
SaldoPendiente -= TxtImporteCredito.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteCredito.Text.ToDecimal
|
PagoAplicado += TxtImporteCredito.Text.ToDecimal
|
||||||
End If
|
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
|
||||||
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
|
||||||
SaldoPendiente -= TxtImporteDebito.Text.ToDecimal
|
|
||||||
PagoAplicado += TxtImporteDebito.Text.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
|
||||||
Dim Obs As String = ""
|
|
||||||
If DivDatosCheque.Visible Then
|
|
||||||
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto)
|
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
||||||
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal
|
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||||
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
SaldoPendiente -= TxtImporteDebito.Text.ToDecimal
|
||||||
End If
|
PagoAplicado += TxtImporteDebito.Text.ToDecimal
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
|
||||||
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
|
||||||
SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal
|
|
||||||
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
|
|
||||||
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
|
||||||
|
|
||||||
PagoAplicado += PagoEfectivo
|
|
||||||
If PagoAplicado >= SaldoTotalInicial Then
|
|
||||||
TxtCambio.Text = (PagoAplicado - SaldoTotalInicial).FormatoNumero
|
|
||||||
PagoEfectivo = SaldoPendiente
|
|
||||||
End If
|
End If
|
||||||
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
|
||||||
SaldoPendiente -= PagoEfectivo
|
|
||||||
End If
|
|
||||||
|
|
||||||
If SaldoPendiente > 0 Then
|
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||||
MsgError = "Tiene saldo pendiente por aplicar"
|
Dim Obs As String = ""
|
||||||
End If
|
If DivDatosCheque.Visible Then
|
||||||
|
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
|
||||||
|
End If
|
||||||
|
|
||||||
If UsuarioActual.CveRol <> 1 Then
|
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, tCveCorte) Then
|
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal
|
||||||
MsgError = "Error al aplicar el corte"
|
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVenta, 0) Then
|
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
||||||
MsgError = "No se pudo desmarcar la impresión"
|
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||||
End If
|
SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal
|
||||||
|
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
If CveVentaRemision > 0 Then
|
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
|
||||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVentaRemision, 0) Then
|
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
||||||
|
|
||||||
|
PagoAplicado += PagoEfectivo
|
||||||
|
If PagoAplicado >= SaldoTotalInicial Then
|
||||||
|
TxtCambio.Text = (PagoAplicado - SaldoTotalInicial).FormatoNumero
|
||||||
|
PagoEfectivo = SaldoPendiente
|
||||||
|
End If
|
||||||
|
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||||
|
SaldoPendiente -= PagoEfectivo
|
||||||
|
End If
|
||||||
|
|
||||||
|
If SaldoPendiente > 0 Then
|
||||||
|
MsgError = "Tiene saldo pendiente por aplicar"
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.CveRol <> 1 Then
|
||||||
|
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, tCveCorte) Then
|
||||||
|
MsgError = "Error al aplicar el corte"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVenta, 0) Then
|
||||||
MsgError = "No se pudo desmarcar la impresión"
|
MsgError = "No se pudo desmarcar la impresión"
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
|
If CveVentaRemision > 0 Then
|
||||||
|
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVentaRemision, 0) Then
|
||||||
|
MsgError = "No se pudo desmarcar la impresión"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
MsgError = "Error al registrar prepólizas"
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
MsgError = "Error al registrar prepólizas"
|
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
|
||||||
|
RegistrarPago = False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@@ -640,15 +645,25 @@ Partial Class Ventas_PVCobranza
|
|||||||
If MsgError = "" Then
|
If MsgError = "" Then
|
||||||
ObjVentas2.Commit()
|
ObjVentas2.Commit()
|
||||||
Dim msBuild As New StringBuilder()
|
Dim msBuild As New StringBuilder()
|
||||||
|
Dim MsgTimbrado As String = ""
|
||||||
|
|
||||||
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
|
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
|
||||||
'If respFactura IsNot Nothing Then
|
If respFactura IsNot Nothing Then
|
||||||
' If Not respFactura.Factura.TimbrarFactura() Then
|
'VERIFICA SI SE GENERO NC
|
||||||
' msBuild.Append("La factura no se pudo timbrar<br/> ")
|
If respNC IsNot Nothing Then
|
||||||
' End If
|
AjustarTimbre(respFactura.Factura, respNC.Factura)
|
||||||
'End If
|
MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura)
|
||||||
|
Else
|
||||||
|
AjustarTimbre(respFactura.Factura, Nothing)
|
||||||
|
MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If respFactura IsNot Nothing Then
|
If respFactura IsNot Nothing Then
|
||||||
msBuild.Append($"Pago Registrado correctamente.")
|
If RegistrarPago Then
|
||||||
|
msBuild.Append($"Pago Registrado correctamente.")
|
||||||
|
End If
|
||||||
|
|
||||||
For Each m In respFactura.Mensajes
|
For Each m In respFactura.Mensajes
|
||||||
msBuild.AppendFormat("<br/> {0}", m)
|
msBuild.AppendFormat("<br/> {0}", m)
|
||||||
Next
|
Next
|
||||||
@@ -663,6 +678,10 @@ Partial Class Ventas_PVCobranza
|
|||||||
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
|
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(MsgTimbrado) Then
|
||||||
|
msBuild.AppendFormat("<br/> {0}", MsgTimbrado)
|
||||||
|
End If
|
||||||
|
|
||||||
Alert(msBuild.ToString(), TipoMensaje.MsgInformacion)
|
Alert(msBuild.ToString(), TipoMensaje.MsgInformacion)
|
||||||
Else
|
Else
|
||||||
ObjVentas2.RollBack()
|
ObjVentas2.RollBack()
|
||||||
@@ -996,6 +1015,79 @@ Partial Class Ventas_PVCobranza
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Sub AjustarTimbre(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura)
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.UUID.Clear()
|
||||||
|
If HdnTipoAmortizacion.Value = "2" Then
|
||||||
|
Dim Anticipos = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "Ant")
|
||||||
|
For Each Ant As Modelos.MAnticipoRelacionado In Anticipos
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
|
||||||
|
Next
|
||||||
|
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
||||||
|
|
||||||
|
'AJUSTAR NC
|
||||||
|
If ObjNC IsNot Nothing Then
|
||||||
|
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
|
||||||
|
|
||||||
|
ObjNC.Timbre.CFDIRelacionados.TipoRelacion = "07"
|
||||||
|
ObjNC.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA
|
||||||
|
If HdnTipoAmortizacion.Value = "4" Then
|
||||||
|
Dim DevolucionesNC = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "NC")
|
||||||
|
For Each Ant As Modelos.MAnticipoRelacionado In DevolucionesNC
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
|
||||||
|
Next
|
||||||
|
|
||||||
|
'TEMPORAL- DEBE SER TIPO RELACION "01 - Nota de crédito de los documentos relacionados"
|
||||||
|
Dim CveTipoRelacion As Integer = 1
|
||||||
|
|
||||||
|
ObjFactura.CveTipoRelacion = CveTipoRelacion
|
||||||
|
|
||||||
|
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}")
|
||||||
|
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
|
||||||
|
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura) As String
|
||||||
|
Dim MsgErrorTimbrado As String = ""
|
||||||
|
Dim SeTimbro As Boolean = False
|
||||||
|
Dim ObjTimbrado As New Timbrado
|
||||||
|
Try
|
||||||
|
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
||||||
|
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
|
||||||
|
MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
|
||||||
|
ObjTimbrado = Nothing
|
||||||
|
|
||||||
|
If SeTimbro AndAlso ObjNC IsNot Nothing Then
|
||||||
|
If ObjNC.Timbre IsNot Nothing Then
|
||||||
|
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
|
||||||
|
ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
|
||||||
|
|
||||||
|
Dim ObjTimbradoNC As New Timbrado
|
||||||
|
Dim TimbroNC As Boolean = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
|
||||||
|
|
||||||
|
If Not TimbroNC Then
|
||||||
|
MsgErrorTimbrado = ObjTimbradoNC.MensajeErrorCFDI
|
||||||
|
End If
|
||||||
|
ObjTimbradoNC = Nothing
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al generar el timbrado", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return MsgErrorTimbrado
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
|
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
|
||||||
Dim Retorno As String = ""
|
Dim Retorno As String = ""
|
||||||
Dim CveIEPago As Integer = 0
|
Dim CveIEPago As Integer = 0
|
||||||
@@ -1751,7 +1843,11 @@ Partial Class Ventas_PVCobranza
|
|||||||
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal()
|
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal()
|
||||||
|
|
||||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||||
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal")})
|
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
|
||||||
|
End If
|
||||||
|
|
||||||
|
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
|
||||||
|
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user