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 Property CveVenta As Integer
|
||||
Public Property FolioFiscal As String
|
||||
Public Property Tipo As String
|
||||
End Class
|
||||
<Serializable>
|
||||
Public Class MVentaDetalleCotizacion
|
||||
@@ -1119,7 +1120,7 @@ Namespace Modelos
|
||||
'MENSAJE PRINCIPAL
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -393,7 +393,11 @@
|
||||
<div class="row">
|
||||
<div class="note note-success">
|
||||
<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-1"><b>Folio:</b></div>
|
||||
@@ -411,10 +415,6 @@
|
||||
<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" />
|
||||
</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>
|
||||
@@ -1272,153 +1272,153 @@
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Scripts/PrintJS/print.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
//function impresionDirecta(urlPDF) {
|
||||
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
|
||||
//}
|
||||
//function impresionDirecta(urlPDF) {
|
||||
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
|
||||
//}
|
||||
|
||||
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
||||
let totalAnt = 0;
|
||||
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
||||
let totalAnt = 0;
|
||||
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
|
||||
//si es con.nc,es.el.total
|
||||
let Total = ToDouble($get("C_LtlSaldo").value);
|
||||
//si es con.nc,es.el.total
|
||||
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 (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 (SaldoCompra > 0) {
|
||||
|
||||
if (AmorContrato > 0) {
|
||||
txt.value = AmorContrato.toFixed(2);
|
||||
} 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 {
|
||||
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
|
||||
txt.value = "";
|
||||
t.checked = false;
|
||||
}
|
||||
|
||||
$("#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 importeTxt = parseFloat(txt.value.replace(/,/g, ''));
|
||||
let Total = ToDouble($get("C_LtlSaldo").value);// ToDouble($get('TxtSubTotal').value);
|
||||
|
||||
if (TipoAnticipo == '4') {
|
||||
Total = ToDouble($get("C_LtlSaldo").value);
|
||||
}
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
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;
|
||||
} 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;
|
||||
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() {
|
||||
let totalPoints = 0;
|
||||
let t = '';
|
||||
saldo = (importeTxt > saldo) ? saldo : importeTxt;
|
||||
|
||||
$('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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
|
||||
|
||||
if (total > totalVenta) {
|
||||
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 CalculaDiferencia() {
|
||||
let total = 0;
|
||||
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
|
||||
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
|
||||
if (ToDouble(txt.value) > 0) {
|
||||
chk.checked = true;
|
||||
} else {
|
||||
chk.checked = false;
|
||||
}
|
||||
|
||||
function CalculaDiferenciaBloqueo() {
|
||||
let total = 0;
|
||||
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
|
||||
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
||||
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() {
|
||||
let totalPoints = 0;
|
||||
let t = '';
|
||||
|
||||
$('input[name*=TxtAnticipo]').each(function () {
|
||||
totalPoints += ToDouble($(this).val());
|
||||
});
|
||||
|
||||
return Math.round(totalPoints * 100) / 100;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
|
||||
|
||||
if (total > totalVenta) {
|
||||
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 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 respNC As Modelos.Factura.MMensajeFactura = Nothing
|
||||
|
||||
Dim RegistrarPago As Boolean = True
|
||||
Try
|
||||
'FACTURAR LA REMISION PARA HACER EL PAGO
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
|
||||
@@ -563,73 +563,78 @@ Partial Class Ventas_PVCobranza
|
||||
End If
|
||||
|
||||
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
|
||||
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
||||
SaldoPendiente -= 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}"
|
||||
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)
|
||||
SaldoPendiente -= TxtImporteCredito.Text.ToDecimal
|
||||
PagoAplicado += TxtImporteCredito.Text.ToDecimal
|
||||
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)
|
||||
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal
|
||||
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
||||
End If
|
||||
|
||||
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
|
||||
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
|
||||
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 SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||
Dim Obs As String = ""
|
||||
If DivDatosCheque.Visible Then
|
||||
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveRol <> 1 Then
|
||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, tCveCorte) Then
|
||||
MsgError = "Error al aplicar el corte"
|
||||
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)
|
||||
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal
|
||||
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
||||
End If
|
||||
End If
|
||||
|
||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVenta, 0) Then
|
||||
MsgError = "No se pudo desmarcar la impresión"
|
||||
End If
|
||||
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 CveVentaRemision > 0 Then
|
||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaTicketImpreso(CveVentaRemision, 0) Then
|
||||
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
|
||||
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"
|
||||
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
|
||||
MsgError = "Error al registrar prepólizas"
|
||||
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
|
||||
RegistrarPago = False
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -640,15 +645,25 @@ Partial Class Ventas_PVCobranza
|
||||
If MsgError = "" Then
|
||||
ObjVentas2.Commit()
|
||||
Dim msBuild As New StringBuilder()
|
||||
Dim MsgTimbrado As String = ""
|
||||
|
||||
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
|
||||
'If respFactura IsNot Nothing Then
|
||||
' If Not respFactura.Factura.TimbrarFactura() Then
|
||||
' msBuild.Append("La factura no se pudo timbrar<br/> ")
|
||||
' End If
|
||||
'End If
|
||||
If respFactura IsNot Nothing Then
|
||||
'VERIFICA SI SE GENERO NC
|
||||
If respNC IsNot Nothing Then
|
||||
AjustarTimbre(respFactura.Factura, respNC.Factura)
|
||||
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
|
||||
msBuild.Append($"Pago Registrado correctamente.")
|
||||
If RegistrarPago Then
|
||||
msBuild.Append($"Pago Registrado correctamente.")
|
||||
End If
|
||||
|
||||
For Each m In respFactura.Mensajes
|
||||
msBuild.AppendFormat("<br/> {0}", m)
|
||||
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>")
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(MsgTimbrado) Then
|
||||
msBuild.AppendFormat("<br/> {0}", MsgTimbrado)
|
||||
End If
|
||||
|
||||
Alert(msBuild.ToString(), TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
ObjVentas2.RollBack()
|
||||
@@ -996,6 +1015,79 @@ Partial Class Ventas_PVCobranza
|
||||
Return Retorno
|
||||
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
|
||||
Dim Retorno As String = ""
|
||||
Dim CveIEPago As Integer = 0
|
||||
@@ -1751,7 +1843,11 @@ Partial Class Ventas_PVCobranza
|
||||
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal()
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user