Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -2590,6 +2590,19 @@ Partial Class Ventas
|
||||
CargaPorcentajeMarcas()
|
||||
|
||||
BloqueaCondiconesPago()
|
||||
|
||||
BloqueaClasificaciones()
|
||||
|
||||
'NO PERMITIR AGREGAR PS DESDE VENTAS EN ECONOLLANTAS
|
||||
If UsuarioActual.CveEmpresa = 141 Then
|
||||
BtnModalAddPS.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BloqueaClasificaciones()
|
||||
If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
DdlClasificacion.Enabled = False
|
||||
DdlUnidadMedida.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BloqueaCondiconesPago()
|
||||
@@ -4376,6 +4389,8 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
DdlTipoRetencion.SelectedValueExist(DbRowVenta("CveTipoRetencion").ToString)
|
||||
|
||||
UpPS.Update()
|
||||
UpContado.Update()
|
||||
UpEstatus.Update()
|
||||
@@ -4794,10 +4809,10 @@ Partial Class Ventas
|
||||
ViewState("ClienteRetIVA") = ObjCliente.RetIVA / 100
|
||||
ViewState("ClienteRetISR") = ObjCliente.RetISR / 100
|
||||
|
||||
DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString)
|
||||
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
|
||||
|
||||
If CveVenta <= 0 Then
|
||||
DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString)
|
||||
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
|
||||
|
||||
ViewState("RetIVAFletes") = ObjCliente.RetieneIVAFletes
|
||||
If ObjCliente.RetieneIVAFletes Then
|
||||
TrRetIVA.Style.Add("display", "")
|
||||
@@ -4806,9 +4821,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ViewState("Vendedor") = ObjCliente.Vendedor
|
||||
ViewState("CtaContable") = ObjCliente.CuentaContable
|
||||
ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes
|
||||
@@ -5819,6 +5831,10 @@ Partial Class Ventas
|
||||
GvPS.DataSource = TmpDT
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
GvPS.DataBind()
|
||||
If UsuarioActual.CveEmpresa = 141 Then
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlClasificacion").Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
|
||||
GvPS.EditIndex = -1
|
||||
@@ -6053,6 +6069,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
|
||||
TrRetIVA.Style.Add("display", "")
|
||||
DdlTipoRetencion.Visible = True
|
||||
End If
|
||||
|
||||
@@ -8392,6 +8409,9 @@ Partial Class Ventas
|
||||
End Select
|
||||
ObjFactura.ComplementoINE = INE
|
||||
End If
|
||||
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
|
||||
ObjFactura.CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CreaObjetosVentaDevolucion()
|
||||
@@ -8791,7 +8811,7 @@ Partial Class Ventas
|
||||
.Descripcion = tPS,
|
||||
.ValorUnitario = drr("PU").ToString.ToDecimal,
|
||||
.Importe = drr("TotalImporte").ToString.ToDecimal,
|
||||
.Descuento = drr("Descuento").ToString.ToDecimal,
|
||||
.Descuento = drr("Descuento").ToString.ToDecimal.RoundSQL(2),
|
||||
.Unidad = drr("UM").ToString,
|
||||
.ClaveUnidad = drr("SATClaveUM").ToString,
|
||||
.ClaveProdServ = drr("SATClaveProdServ").ToString,
|
||||
@@ -9300,6 +9320,10 @@ Partial Class Ventas
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim CveTipoRetencion As Integer = -1
|
||||
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
|
||||
CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
|
||||
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
|
||||
@@ -9316,7 +9340,7 @@ Partial Class Ventas
|
||||
CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)),
|
||||
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
|
||||
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
|
||||
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion) Then
|
||||
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) Then
|
||||
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Else
|
||||
If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then
|
||||
@@ -10564,7 +10588,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
Case 8 'Ret IVA por Trasladar
|
||||
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then
|
||||
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion <> 4 Then 'SI NO ES RETENCION DE IVA DE SERVICIOS
|
||||
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
|
||||
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
@@ -10572,17 +10596,12 @@ Partial Class Ventas
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
||||
|
||||
'CONTABILIDAD CONTPAQ
|
||||
'SI LA RETENCION ES AL 6% DEBE USAR ESTA CUENTA
|
||||
If UsuarioActual.Empresa.Funcionalidad(580).ToEntero() > 0 AndAlso (DdlTipoRetencion.SelectedValue = "4") Then
|
||||
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(580).ToEntero()
|
||||
If IdCtaContRetIVA > 0 Then
|
||||
IdCtaContable = IdCtaContRetIVA
|
||||
Else
|
||||
If IdCtaContRetIVA > 0 Then
|
||||
IdCtaContable = IdCtaContRetIVA
|
||||
Else
|
||||
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
||||
End If
|
||||
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -10599,6 +10618,25 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
Case 313 'Ret Iva Servicios
|
||||
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion = 4 Then 'SI TIENE RETENCION DE IVA DE SERVICIOS
|
||||
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
|
||||
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
CveSubProyectoContabilizar = CveSubProyectoVenta
|
||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
||||
|
||||
'OBTENER CUENTAS
|
||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
'Conta ContPAQ
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
'Conta SIG
|
||||
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Case 9 'Ret ISR por Trasladar
|
||||
@@ -12367,14 +12405,20 @@ Partial Class Ventas
|
||||
' Exit Sub
|
||||
'End If
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
Dim Cantidad, PU, Descuento As Decimal
|
||||
Dim TotalDescuentosRound As Decimal = 0
|
||||
Dim Cantidad, PU, Descuento, DescuentoRound As Decimal
|
||||
|
||||
For Each dr As DataRow In TmpDT.Rows
|
||||
Cantidad = dr("Cantidad").ToString.ToDecimal
|
||||
PU = dr("PU").ToString.ToDecimal
|
||||
'proporcional la mortización al concepto
|
||||
Descuento = PU * Cantidad / LblSubTotal1.Text.ToDecimal * Amortizacion
|
||||
Descuento = (PU * Cantidad / LblSubTotal1.Text.ToDecimal * Amortizacion)
|
||||
DescuentoRound = Descuento.RoundSQL(NumeroDecimales)
|
||||
|
||||
TotalDescuentosRound += DescuentoRound
|
||||
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
dr("Descuento") = Descuento
|
||||
dr("Descuento") = DescuentoRound
|
||||
dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
||||
dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
dr("ImporteIEPS") = Math.Round(dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
@@ -12383,6 +12427,19 @@ Partial Class Ventas
|
||||
dr("PorcentajeRetIVA") = ClienteRetIVA
|
||||
dr("PorcentajeRetISR") = ClienteRetISR
|
||||
Next
|
||||
|
||||
'REVISA SI EXISTEN DIFERENCIAS ENTRE EL DESCUENTO Y LO AMORTIZADO PARA REALIZAR UN AJUSTE EN EL ULTIMO CONCEPTO AGREGADO
|
||||
Dim diff As Decimal = Math.Abs(TotalDescuentosRound - Amortizacion)
|
||||
Dim DrUltimo As DataRow = TmpDT.Rows(TmpDT.Rows.Count - 1)
|
||||
'SI EL DESCUENTO SUPERA LO AMORTIZADO RESTA LA DIFERENCIA AL ULTIMO DESCUENTO
|
||||
If TotalDescuentosRound > Amortizacion Then
|
||||
DrUltimo("Descuento") = DrUltimo("Descuento").ToString().ToDecimal() - diff
|
||||
End If
|
||||
'SI EL DESCUENTO ES MENOR A LO AMORTIZADO SUMA LA DIFERENCIA AL ULTIMO DESCUENTO
|
||||
If TotalDescuentosRound < Amortizacion Then
|
||||
DrUltimo("Descuento") = DrUltimo("Descuento").ToString().ToDecimal() + diff
|
||||
End If
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
|
||||
@@ -14209,6 +14266,7 @@ Partial Class Ventas
|
||||
CargaGvComercioExterior()
|
||||
End If
|
||||
End If
|
||||
UpPS.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -14461,6 +14519,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
|
||||
TrRetIVA.Style.Add("display", "")
|
||||
DdlTipoRetencion.Visible = True
|
||||
End If
|
||||
|
||||
@@ -17052,6 +17111,9 @@ Partial Class Ventas
|
||||
Else
|
||||
Alert("El producto no fue encontrado.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
UpPS.Update()
|
||||
|
||||
End Sub
|
||||
Private Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMoneda.SelectedIndexChanged
|
||||
CambiaMoneda()
|
||||
@@ -17473,6 +17535,28 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Private Function ValidaPagosContado() As Boolean
|
||||
Dim Retorno = False
|
||||
'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO
|
||||
If UsuarioActual.CveEmpresa = 141 AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
|
||||
|
||||
If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then
|
||||
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
|
||||
|
||||
If TotalPago < Total Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
Return Retorno
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS
|
||||
If Me.SaldoVenta > 0 Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
||||
@@ -17480,6 +17564,21 @@ Partial Class Ventas
|
||||
Retorno = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
|
||||
|
||||
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
|
||||
|
||||
If TotalPago < Total Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
Return Retorno
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
|
||||
If TotalNC > 0 Then
|
||||
@@ -23914,6 +24013,20 @@ Partial Class Ventas
|
||||
Retorno = False
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
|
||||
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
|
||||
|
||||
If TotalPago < Total Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = False
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
|
||||
Reference in New Issue
Block a user