CRM Correciones nombre AcercamientosModel

This commit is contained in:
rakcsle
2024-02-20 11:26:51 -07:00
parent cd4933b261
commit 52dfa43734
5 changed files with 157 additions and 95 deletions

View File

@@ -1633,12 +1633,13 @@ Partial Class General_SaldosIniciales
Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero()
If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True
' If Not CveSucursal > 0 Then Alert("No se encontró la sucursal.", TipoMensaje.MsgError) : ErrorVentas = True
If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorVentas = True
Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
Dim CountRow As Integer = 1
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'")
Dim TipoDocto As String = Row("Tipo Documento").ToString().Trim
@@ -1684,7 +1685,36 @@ Partial Class General_SaldosIniciales
Dim IVADetalle As Decimal = 0
If RblFormato.SelectedValue = "17" Then
Dim CodigoDetalle As String = Row("Codigo").ToString
If CodigoDetalle.Trim.Length > 0 Then
Dim DrDetalles As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = {CodigoDetalle}")
If DrDetalles IsNot Nothing Then
CvePS = DrDetalles("CvePS").ToString().ToEntero()
CveUnidadMedida = DrDetalles("CveUnidadMedida").ToString().ToEntero()
CveClasificacion = DrDetalles("CveClasificacion").ToString().ToEntero()
Else
Alert($"El código del producto no se encontro, error en registro {CountRow}")
ErrorVentas = True
End If
Else
Alert($"El código es requerido, error en registro {CountRow}")
ErrorVentas = True
End If
IEPSDetalle = Row("IEPS").ToString.ToDecimal
CantidadDetalle = Row("Cantidad").ToString.ToDecimal
PUDetalle = Row("PU").ToString.ToDecimal
IVADetalle = Row("IVA").ToString.ToDecimal
If CantidadDetalle = 0 Then
Alert($"No se especifico la cantidad, error en registro {CountRow}")
ErrorVentas = True
End If
End If
If dt.Columns.Contains("Cliente Sucursal") AndAlso Row("Cliente Sucursal").ToString() <> "" Then
@@ -1759,11 +1789,19 @@ Partial Class General_SaldosIniciales
If RblFormato.SelectedValue = "17" Then
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle * CantidadDetalle, IVADetalle, (PUDetalle * CantidadDetalle) + IVADetalle - IEPSDetalle, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0,
Dim TotalDetalles As Decimal = SubTotal
If PUDetalle > 0 Then
TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle
End If
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle * CantidadDetalle, IVADetalle, TotalDetalles, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0,
PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle) Then
ErrorVentas = True
Exit For
End If
Else
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, IVA, SubTotal * PorcentajeIVA, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=0) Then
ErrorVentas = True
@@ -1839,6 +1877,7 @@ Partial Class General_SaldosIniciales
Exit For
End If
CountRow = CountRow + 1
Next
If Not ErrorVentas Then
Alert(String.Format("Se agregaron: <b>{0}</b> Ventas correctamente. <b>{1} no encontrados</b><br/>{2} ", Encontrados, NoEncontrados, StrRFCNoencontrados), TipoMensaje.MsgInformacion)