diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index cd18bf021..e22b5f793 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -429,22 +429,22 @@ Public Class WS_PuntoVenta Return Respuesta End Function - - Public Function GetSucursales(CveEmpresa As Integer) As RespuestaWS - Dim objSucursales As New ClsSucursales - Dim Respuesta As New RespuestaWS + ' + 'Public Function GetSucursales(CveEmpresa As Integer) As RespuestaWS + ' Dim objSucursales As New ClsSucursales + ' Dim Respuesta As New RespuestaWS - If objSucursales.GetSucursales() Then - Respuesta.Datos = objSucursales.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - Respuesta.Datos.TableName = "Resultados" - Respuesta.HuboError = False - Else - Respuesta.Descripcion = "HUBO UN ERROR" - End If + ' If objSucursales.GetSucursales() Then + ' Respuesta.Datos = objSucursales.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) + ' Respuesta.Datos.TableName = "Resultados" + ' Respuesta.HuboError = False + ' Else + ' Respuesta.Descripcion = "HUBO UN ERROR" + ' End If - objSucursales.Dispose() - Return Respuesta - End Function + ' objSucursales.Dispose() + ' Return Respuesta + 'End Function Public Function GetClientes(CveEmpresa As Integer) As RespuestaWS @@ -1170,7 +1170,7 @@ Public Class WS_PuntoVenta 'Enviar correo de corte de turno EnviarCorreo(VtaCorte.CveCorte, VtaCorte.CveEmpresa) - Dim cuenta As Integer = GetCuenta(2090) + ' Dim cuenta As Integer = GetCuenta(2090) Else objPV.RollBack() End If @@ -1197,16 +1197,16 @@ Public Class WS_PuntoVenta Return objVentasPago End Function - - Public Function GetCuenta(CveSucursal As Integer) As Integer - Dim objSU As New ClsSucursales - Dim Cuenta As Integer + ' + 'Public Function GetCuenta(CveSucursal As Integer) As Integer + ' Dim objSU As New ClsSucursales + ' Dim Cuenta As Integer - 'Cuenta = objSU.GetCuenta(CveSucursal) - objSU.Dispose() + ' 'Cuenta = objSU.GetCuenta(CveSucursal) + ' objSU.Dispose() - Return Cuenta - End Function + ' Return Cuenta + 'End Function Public Function AddBancosIE(Importe As Double, Moneda As Integer, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, Cuenta As Integer, Comprobante As String, Opcion As String) As Boolean diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e744b495e..e7fb5937f 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10963,25 +10963,39 @@ Partial Class Ventas 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() End If End If - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - If importeMovimiento > 0 AndAlso UsuarioActual.CveEmpresa = 119 Then - 'código fijo en base el porcentaje iva, que se afecten las clasificaciones - For i = 0 To TmpDTDetalle.Rows.Count - 1 - 'If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal > 0 Then - ' If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal = 0.08 Then - ' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8% - ' Else - ' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16% - ' End If - 'Else - ' TmpDTDetalle(i)("CveClasificacion") = 19930 'clasif: ventas tasa 0% - 'End If - If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString() + DT = TmpDTDetalle.FiltraParametros("", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"}) + + If DT.Rows.Count > 0 Then + 'Se agrega movimiento separado por la cuenta de ventas (ER) + For Each Row2 As DataRow In DT.Rows + importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador + importeMX = importeMovimiento * tipoCambio * Multiplicador + FechaMovimiento = ObjFactura.FechaPago + Concepto = $"{ViewState("VentaFolio").ToString()} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}" + + If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas + If ObjFactura.TipoDocto.Contiene("Egs") Then + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() + Else + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() + End If + + If importeMovimiento <> 0 Then + + If IdCtaContable <= 0 Then + CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) + idCuentaContabilizacion = 0 + End If + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 103, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=Row2("CveSubProyecto").ToString().ToEntero(), ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then + ErrorPrepoliza = True + Else + ViewState("SeGuardoPrePoliza") = True + End If End If Next - End If End If