@@ -7141,121 +7327,121 @@
var ValorTxt = Obj.value;
var suma = 0;
var total = parseFloat($('#<%= HplSaldoAuxiliar.ClientID%>').text().replace(',', ''));
- $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
- var currentsaldo = parseFloat($(this).val())
- if (isNaN(currentsaldo)) { currentsaldo = 0 }
- suma = currentsaldo + suma;
- });
- var txtvalue = (total - suma) + parseFloat(ValorTxt);
- if (txtvalue < 0) { txtvalue = 0; }
- if (txtvalue < Monto) { Monto = txtvalue.toFixed(2); }
+ $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
+ var currentsaldo = parseFloat($(this).val())
+ if (isNaN(currentsaldo)) { currentsaldo = 0 }
+ suma = currentsaldo + suma;
+ });
+ var txtvalue = (total - suma) + parseFloat(ValorTxt);
+ if (txtvalue < 0) { txtvalue = 0; }
+ if (txtvalue < Monto) { Monto = txtvalue.toFixed(2); }
- if (isNaN(ValorTxt))
- ValorTxt = 0;
- if (isNaN(Monto))
- Monto = 0;
- if (parseFloat(ValorTxt) < 0) {
- ValorTxt = 0;
- Obj.value = 0;
- }
+ if (isNaN(ValorTxt))
+ ValorTxt = 0;
+ if (isNaN(Monto))
+ Monto = 0;
+ if (parseFloat(ValorTxt) < 0) {
+ ValorTxt = 0;
+ Obj.value = 0;
+ }
- if (parseFloat(ValorTxt) > parseFloat(Monto)) {
- alert("El monto de ''Anticipo a Amortizar'' no puede ser mayor al monto del ''Anticipo''");
- Obj.value = Monto;
- }
- }
- function ImprimirCotizacion() {
- __doPostBack('ctl00$HB$LNKImprimirCotizacion', '');
- }
- function SetText2(ObjTo, Value) {
- ObjTo.innerText = Value;
- }
+ if (parseFloat(ValorTxt) > parseFloat(Monto)) {
+ alert("El monto de ''Anticipo a Amortizar'' no puede ser mayor al monto del ''Anticipo''");
+ Obj.value = Monto;
+ }
+ }
+ function ImprimirCotizacion() {
+ __doPostBack('ctl00$HB$LNKImprimirCotizacion', '');
+ }
+ function SetText2(ObjTo, Value) {
+ ObjTo.innerText = Value;
+ }
- //VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C
- function ValidarCantidad(t, c) {
- t.value = (t.value > c ? c : t.value)
- }
+ //VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C
+ function ValidarCantidad(t, c) {
+ t.value = (t.value > c ? c : t.value)
+ }
- //VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MENOR A C
- function ValidarCantidadMenor(t, c) {
- t.value = (t.value > c ? t.value : c)
- }
+ //VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MENOR A C
+ function ValidarCantidadMenor(t, c) {
+ t.value = (t.value > c ? t.value : c)
+ }
- function Comma(Num) { //function to add commas to textboxes
- Num += '';
- Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
- Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
- x = Num.split('.');
- x1 = x[0];
- x2 = x.length > 1 ? '.' + x[1] : '';
- var rgx = /(\d+)(\d{3})/;
- while (rgx.test(x1))
- x1 = x1.replace(rgx, '$1' + ',' + '$2');
- return x1 + x2;
- }
+ function Comma(Num) { //function to add commas to textboxes
+ Num += '';
+ Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
+ Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
+ x = Num.split('.');
+ x1 = x[0];
+ x2 = x.length > 1 ? '.' + x[1] : '';
+ var rgx = /(\d+)(\d{3})/;
+ while (rgx.test(x1))
+ x1 = x1.replace(rgx, '$1' + ',' + '$2');
+ return x1 + x2;
+ }
- function AddCodigoBarrasSerie(e) {
- if (e.keyCode == 13 || e.which == 13) {
- $('#BtnCodigoBarrasSerie').click();
- }
- }
+ function AddCodigoBarrasSerie(e) {
+ if (e.keyCode == 13 || e.which == 13) {
+ $('#BtnCodigoBarrasSerie').click();
+ }
+ }
- //SERIE PS
- function SeriePS(e, b, txt, hdn) {
- ;
- if (e.keyCode == 13 || e.which == 13) {
- if (txt.value != "" && txt.value != hdn.value) {
- $(b).click();
- }
- }
- }
+ //SERIE PS
+ function SeriePS(e, b, txt, hdn) {
+ ;
+ if (e.keyCode == 13 || e.which == 13) {
+ if (txt.value != "" && txt.value != hdn.value) {
+ $(b).click();
+ }
+ }
+ }
- function SeriePSBlur(b, txt, hdn) {
- ;
- if (txt.value != "" && txt.value != hdn.value) {
- $(b).click();
- }
- }
+ function SeriePSBlur(b, txt, hdn) {
+ ;
+ if (txt.value != "" && txt.value != hdn.value) {
+ $(b).click();
+ }
+ }
- //SERIE-LOTE INV
- var H1 = "";
- var H2 = "";
- var T = "";
+ //SERIE-LOTE INV
+ var H1 = "";
+ var H2 = "";
+ var T = "";
- function EnterAFEdit(event, Txt, Hdn1, Hdn2) {
- if (event.which == 13 || event.keyCode == 13) {
- H1 = Hdn1;
- H2 = Hdn2;
- T = Txt;
- $get("HdnCodAFEdit").value = Txt.value;
+ function EnterAFEdit(event, Txt, Hdn1, Hdn2) {
+ if (event.which == 13 || event.keyCode == 13) {
+ H1 = Hdn1;
+ H2 = Hdn2;
+ T = Txt;
+ $get("HdnCodAFEdit").value = Txt.value;
- $('#BtnVinculaAFEdit').click();
- }
- }
+ $('#BtnVinculaAFEdit').click();
+ }
+ }
- function AFBlurEdit(Txt, Hdn1, Hdn2) {
- if (Txt.value.length > 0 && Txt.value != Hdn2.value) {
- H1 = Hdn1;
- H2 = Hdn2;
- T = Txt;
- $get("HdnCodAFEdit").value = Txt.value;
- $('#BtnVinculaAFEdit').click();
- }
- }
+ function AFBlurEdit(Txt, Hdn1, Hdn2) {
+ if (Txt.value.length > 0 && Txt.value != Hdn2.value) {
+ H1 = Hdn1;
+ H2 = Hdn2;
+ T = Txt;
+ $get("HdnCodAFEdit").value = Txt.value;
+ $('#BtnVinculaAFEdit').click();
+ }
+ }
- function EnterAFEditOK(Cve, Codigo) {
- $get(H1.id).value = Cve;
- $get(H2.id).value = Codigo;
- $get(T.id).value = (Codigo == -1) ? "" : Codigo;
+ function EnterAFEditOK(Cve, Codigo) {
+ $get(H1.id).value = Cve;
+ $get(H2.id).value = Codigo;
+ $get(T.id).value = (Codigo == -1) ? "" : Codigo;
- }
+ }
- //Suma Totales
- function FnSuma() {
- $get('TxtSubTotal2').value = FormatoNumero(ToDouble($get('TxtSubTotal').value) - ToDouble($get('LblDescuentos').innerHTML) - ToDouble($get('LblAmortizacion').innerHTML), 2);
- var totalVenta = ToDouble($get('TxtSubTotal2').value) + ToDouble($get('TxtIVA').value) + ToDouble($get('TxtIEPS') ? ToDouble($get('TxtIEPS').value) : 0) - ToDouble($get('TxtRetIVA').value) - ToDouble($get('TxtRetISR').value);
- debugger;
- $("#<%=GvImpuestosLocales2.ClientID%> input[type='text']").each(function () {
+ //Suma Totales
+ function FnSuma() {
+ $get('TxtSubTotal2').value = FormatoNumero(ToDouble($get('TxtSubTotal').value) - ToDouble($get('LblDescuentos').innerHTML) - ToDouble($get('LblAmortizacion').innerHTML), 2);
+ var totalVenta = ToDouble($get('TxtSubTotal2').value) + ToDouble($get('TxtIVA').value) + ToDouble($get('TxtIEPS') ? ToDouble($get('TxtIEPS').value) : 0) - ToDouble($get('TxtRetIVA').value) - ToDouble($get('TxtRetISR').value);
+ debugger;
+ $("#<%=GvImpuestosLocales2.ClientID%> input[type='text']").each(function () {
if ($(this).attr("class") == '5') // cuando es traslado de impuesto local, se suma
totalVenta += ToDouble($(this).val().toString());
@@ -7325,60 +7511,60 @@
var Total = ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
- let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
+ let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
- if (isNaN(importeTxt)) {
- importeTxt = 0;
- } else {
- if (importeTxt <= 0) {
- importeTxt = 0;
- chk.checked = false;
- return;
- }
- }
+ if (isNaN(importeTxt)) {
+ importeTxt = 0;
+ } else {
+ if (importeTxt <= 0) {
+ importeTxt = 0;
+ chk.checked = false;
+ return;
+ }
+ }
- saldo = (importeTxt > saldo) ? saldo : importeTxt;
+ 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;
+ 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;
- }
+ if (ToDouble(txt.value) > 0) {
+ chk.checked = true;
+ } else {
+ chk.checked = false;
+ }
- if (ToDouble(txt.value) > saldo) {
- txt.value = saldo;
- alert("El Importe no debe de exceder a el saldo");
- }
+ if (ToDouble(txt.value) > saldo) {
+ txt.value = saldo;
+ alert("El Importe no debe de exceder a el saldo");
+ }
- $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
+ $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
- $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
- }
+ $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
+ }
- function FnSumaValoresAnt() {
- debugger;
- var totalPoints = 0;
- var t = '';
+ function FnSumaValoresAnt() {
+ debugger;
+ var totalPoints = 0;
+ var t = '';
- $('input[name*=TxtAnticipo]').each(function () {
- totalPoints += ToDouble($(this).val());
- });
+ $('input[name*=TxtAnticipo]').each(function () {
+ totalPoints += ToDouble($(this).val());
+ });
- return Math.round(totalPoints * 100) / 100;
- }
+ return Math.round(totalPoints * 100) / 100;
+ }
- function LimpiaModal() {
- $('#<%= TxtDireccion.ClientID %>').val('');
+ function LimpiaModal() {
+ $('#<%= TxtDireccion.ClientID %>').val('');
$('#<%= TxtColonia.ClientID %>').val('');
$('#<%= TxtCiudad.ClientID %>').val('');
$('#<%= TxtEstado.ClientID %>').val('');
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 294572c12..e547451d3 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -1710,6 +1710,31 @@ Partial Class Ventas
#End Region
+#Region "AuxiliarConta"
+ Property CvePrePolizaNegativa As Integer
+ Get
+ If ViewState("CvePrePolizaNegativa") Is Nothing Then
+ Return -1
+ Else
+ Return ViewState("CvePrePolizaNegativa").ToString.ToEntero
+ End If
+
+ End Get
+ Set(value As Integer)
+ ViewState("CvePrePolizaNegativa") = value
+ End Set
+ End Property
+
+ Private Property DTDatos As DataTable
+ Get
+ Return CType(ViewState("DTDatos"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTDatos") = value
+ End Set
+ End Property
+#End Region
+
#Region " A C U M U L A D O R E S"
Private Property ClienteEsDistribuidor As Boolean
@@ -3642,7 +3667,7 @@ Partial Class Ventas
HLPagar.NavigateUrl = $"/Bancos/PopIEVentas.aspx?CveVenta={CveVenta}&TB_iframe=true&height=500&width=675"
HlCuentaTerminal.Visible = True
End If
-
+ CargarSaldoAuxiliar(CveCliente)
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then ' si tiene acceso en el subproyecto
'LkNotaCredito.Visible = UsuarioActual.TienePermisoProceso(175)
@@ -26096,4 +26121,123 @@ Partial Class Ventas
End If
ObjVentas.Dispose()
End Sub
+
+#Region "Auxiliar"
+ Private Sub CargarSaldoAuxiliar(CveCliente As Integer)
+
+ CargaAuxiliarClienteCxC(CveCliente, CveVenta)
+
+ End Sub
+
+ Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer)
+ Dim ObjMovtos As New ClsMovimientos()
+ If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then
+ DtDatos = ObjMovtos.DtResultados
+ GVAuxiliar.DataSource = ObjMovtos.DtResultados
+ Else
+ GVAuxiliar.DataSource = Nothing
+ End If
+ ObjMovtos.Dispose()
+ GVAuxiliar.DataBind()
+ End Sub
+
+ Protected Sub BtnCancelarAux_Click(sender As Object, e As EventArgs)
+ AgregaPolizaNegativo(CvePrePolizaNegativa)
+ End Sub
+
+ Private Sub AgregaPolizaNegativo(CvePrePoliza As Integer)
+
+ Dim ObjContabilidad As New ClsContabilidad
+ Dim TieneError As Boolean = False
+ ObjContabilidad.IniciaTransacSQL()
+
+ Dim CvePrePolizaNueva As Integer = ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate)
+
+ If Not CvePrePolizaNueva > 0 Then
+
+
+ TieneError = True
+ End If
+
+ If Not TieneError Then
+
+ ObjContabilidad.Commit()
+ Dim Str As New StringBuilder
+ Str.Append("Se agrego la póliza de cancelación correctamente.
")
+ RegistraScript(" $('#DivCancelar').modal('hide'); ")
+ If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
+ If ObjContabilidad.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
+ Str.AppendFormat("
Ver Poliza", ObjContabilidad.ContaIdPoliza)
+
+ End If
+ End If
+ Alert(Str.ToString)
+ Else
+ ObjContabilidad.RollBack()
+
+ End If
+
+
+
+ ObjContabilidad.Dispose()
+ CargarSaldoAuxiliar(CveCliente)
+
+ End Sub
+
+ Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound
+
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ If e.Row.RowIndex = 0 Then
+ e.Row.BackColor = Drawing.Color.LightGray
+ e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: "
+ e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right
+ e.Row.Cells(0).ColumnSpan = 2
+ e.Row.Cells(1).Visible = False
+ e.Row.Cells(4).ColumnSpan = 3
+ e.Row.Cells(5).Visible = False
+ e.Row.Cells(6).Visible = False
+ e.Row.Cells(7).Visible = False
+ e.Row.Cells(8).Visible = False
+ ElseIf e.Row.RowIndex = 1 Then
+ e.Row.Cells(0).Width = Unit.Pixel(95)
+ e.Row.Cells(1).Width = Unit.Pixel(180)
+ e.Row.Cells(2).Width = Unit.Pixel(80)
+ e.Row.Cells(3).Width = Unit.Pixel(80)
+ e.Row.Cells(4).Width = Unit.Pixel(83)
+ e.Row.Cells(5).Width = Unit.Pixel(93)
+ e.Row.Cells(6).Width = Unit.Pixel(85)
+ e.Row.Cells(7).Width = Unit.Pixel(95)
+ e.Row.Cells(8).Width = Unit.Pixel(70)
+ End If
+
+ e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
+ e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
+ e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
+ e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left
+
+ If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then
+ Dim Liga As String = String.Format("
", e.Row.DBCampo("IdPoliza"))
+ e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("Poliza"))
+ End If
+
+ If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then
+ Dim Liga As String = String.Format("
", e.Row.DBCampo("CvePersonal"))
+ e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable"))
+ End If
+
+ If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then
+ e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}"
+
+ ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then
+ e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}"
+ End If
+
+ If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then
+ e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}"
+
+ End If
+ End If
+ End Sub
+
+#End Region
End Class
\ No newline at end of file