diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 29036f542..ccd0a5d7e 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -1193,11 +1193,22 @@ - - + <%----%> + <%----%>

+
+
+
+ +
+ $ + + +

+
+
@@ -3180,7 +3191,17 @@ var totalTransferencia = ToDouble($get("TxtImporteTransferencia").value); var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia; + + var totalVenta = ToDouble($get('TxtTotal').value); + + if (totalEfectivo > totalVenta) { + $get("TxtCambio").value = FormatoNumero(totalEfectivo - totalVenta); + } else { + $get("TxtCambio").value = "0.00"; + } + $get("TxtImporteContado").value = total; + } // **************************************************************************************************************************************************************************** @@ -3491,9 +3512,17 @@ $('#divAgregarCliente').modal(); } + function hideDivEC() { $('#divAgregarCliente').modal('hide'); } + function CambiaAjuste(txt, txtajuste) { + Recalcula(); + if (txtajuste != null) { + txtajuste.value = ToDouble(txt.value) + } + } + diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 4e27af4bd..d212cc67b 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -1032,8 +1032,8 @@ Partial Class PV TxtFecha.Text = Now.ToShortDateString() LblUsuario.Text = UsuarioActual.Usuario - TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();") + TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';") 'ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';") ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") @@ -1476,7 +1476,7 @@ Partial Class PV HdnIVAOriginal.Value = TxtIVA.Text 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") + 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False @@ -1967,7 +1967,7 @@ Partial Class PV Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion) 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") + 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") UpContado.Update() End Sub @@ -3085,7 +3085,7 @@ Partial Class PV End If 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") + 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") UpContado.Update() Else @@ -3903,7 +3903,7 @@ Partial Class PV HdnIVAOriginal.Value = TxtIVA.Text 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - CVImporteContado.ValueToCompare = Total.ToString + 'CVImporteContado.ValueToCompare = Total.ToString Dim view As DataView = New DataView(TmpDT) view.Sort = "Consec" @@ -4264,6 +4264,7 @@ Partial Class PV TxtImporteCheque.Text = "0.00" TxtImporteTransferencia.Text = "0.00" TxtImporteContado.Text = "0.00" + TxtCambio.Text = "0.00" End Sub Private Sub LimpiaEscondeContado() 'LIMPIA @@ -4336,7 +4337,7 @@ Partial Class PV 'JJMQ 20160506: Validacion para no pagar de mas a peticion de I.P. Dim abonado = DtPagos.SUM("Importe") Dim saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado - CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString + 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString CargaGridContado() UpContado.Update() @@ -4350,7 +4351,7 @@ Partial Class PV If total <= 0 Then Alert("No se ha ingresado importe", TipoMensaje.MsgAdvertencia) : Exit Sub - If DtPagos.SUM("Importe").ToString.ToDecimal + total > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString.ToDecimal + total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor rectifique.", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -4363,7 +4364,7 @@ Partial Class PV DrEfectivo("TipoMovimiento") = "Pago en Efectivo" DrEfectivo("CveCuenta") = DdlCuentaEfectivo.SelectedValue DrEfectivo("Cuenta") = DdlCuentaEfectivo.SelectedItem.Text - DrEfectivo("Importe") = TxtImporteEfectivo.Text + DrEfectivo("Importe") = TxtImporteEfectivo.Text.ToDecimal - TxtCambio.Text.ToDecimal DrEfectivo("Folio") = CargaFolioContado(DdlCuentaEfectivo.SelectedValue.ToEntero, 6) DrEfectivo("Observaciones") = "" DrEfectivo("Tipo") = "Caja Chica" @@ -4456,7 +4457,7 @@ Partial Class PV 'JJMQ 20160506: Validacion para no pagar de mas a peticion de I.P. abonado = DtPagos.SUM("Importe") saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado - CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString + 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString CargaGridContado() UpContado.Update() @@ -4873,7 +4874,7 @@ Partial Class PV Dim ObjVenta As New ClsVentas If ObjVenta.GetVentas(UsuarioActual.CveEmpresa, "Ing", "-1", -1, "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then DdlFacturas.DataSource = ObjVenta.DtResultados - DdlFacturas.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlFacturas.Items.Insert(0, New ListItem("Sin Factura", "-1")) End If ObjVenta.Dispose() DdlFacturas.DataBind() @@ -4888,7 +4889,7 @@ Partial Class PV End If - DdlFacturas.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlFacturas.Items.Insert(0, New ListItem("Sin Factura", "-1")) DdlTipoUso.DataSource = GlobalDTAcumTiposUso.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -4920,7 +4921,7 @@ Partial Class PV DtPUFacturas.Rows.Clear() If DdlFacturas.SelectedValue.ToEntero > 0 Then - TxtPUFactura.Enabled = False + 'TxtPUFactura.Enabled = False Dim ObjVenta As New ClsVentas If ObjVenta.GetVentaDetalle(DdlFacturas.SelectedValue.ToEntero) Then DdlPSAjuste.DataSource = ObjVenta.DtResultados @@ -4929,8 +4930,8 @@ Partial Class PV End If ObjVenta.Dispose() Else - TxtPUFactura.Enabled = True - TxtPUFactura.Text = "" + 'TxtPUFactura.Enabled = True + 'TxtPUFactura.Text = "" DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) End If DdlPSAjuste.DataBind() @@ -4944,11 +4945,13 @@ Partial Class PV LimpiaAjuste() If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.FiltraParametros($"ConsecutivoVenta = {ConsecutivoVenta}").Rows.Count > 0 Then ModalidadAjuste = "U" + TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});") ChkAjuste.Checked = True DivAjuste.Visible = True CargaAjusteDetalle() Else ModalidadAjuste = "A" + TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") End If End Sub @@ -4958,6 +4961,7 @@ Partial Class PV TxtCodEnsamble.Text = "" DdlTipoUso.SelectedIndex = -1 TxtCodLinea.Text = "" + TxtPUFactura.Text = "" TxtFechaAjuste.Text = Now.ToShortDateString CEEFechaAjuste.EndDate = Now TxtCodInspeccion.Text = "" @@ -5023,11 +5027,11 @@ Partial Class PV End If Contador += 1 Next - TxtPUFactura.Text = PUFactura.FormatoNumero(2) + 'TxtPUFactura.Text = PUFactura.FormatoNumero(2) End If If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then - TxtPUFactura.Text = "" + 'TxtPUFactura.Text = "" End If CalculaPorcentajeAjuste() @@ -5115,6 +5119,9 @@ Partial Class PV 'End Function Private Sub GuardaAjuste() + TxtPUFactura.Text = TxtPrecio.Text + UpAjuste.Update() + Dim CargoAnterior As Double = 0 Dim CargoActual As Double = 0 If ModalidadAjuste = "A" Then @@ -5222,9 +5229,12 @@ Partial Class PV DivAjuste.Attributes.Add("class", "col-md-6") DivDatosVenta.Attributes.Remove("class") DivDatosVenta.Attributes.Add("class", "col-md-6") + TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});") + TxtPUFactura.Text = TxtPrecio.Text Else DivAjuste.Visible = False TxtCantidad.Enabled = True + TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") DivModalVenta.Attributes.Remove("class") DivModalVenta.Attributes.Add("class", "modal-dialog") DivAjuste.Attributes.Remove("class") diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8e41c2d63..70613a035 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -15679,7 +15679,6 @@ Partial Class Ventas Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) Next