Se agregaron conceptos de acreedores en Compras, ProveedoresAbonar, PopIECompras y ReembolsosComprobaciones

This commit is contained in:
Raul Pimienta
2020-03-13 00:18:08 -07:00
9 changed files with 108 additions and 37 deletions

2
.gitignore vendored
View File

@@ -14,7 +14,7 @@ LogTimbrado.txt
*.user *.user
*.userosscache *.userosscache
*.sln.docstates *.sln.docstates
vwd.webinfo
# User-specific files (MonoDevelop/Xamarin Studio) # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs *.userprefs

View File

@@ -4359,7 +4359,8 @@ Public Class ClsVentas
Return retorno Return retorno
End Function End Function
Public Function GetRepMetasVendedores(FechaMesActual As String, CveEmpresa As Integer, CveVendedor As Integer, CveCategoria As Integer, CveClasificacion As Integer, Public Function GetRepMetasVendedores(FechaMesActual As String, CveEmpresa As Integer, CveVendedor As Integer, CveCategoria As Integer, CveClasificacion As Integer,
CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer) As Boolean CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer,
Optional GrupoSuperior As Integer = 0) As Boolean
Dim retorno As Boolean = False Dim retorno As Boolean = False
DataAdapter("PA_Vta_MetasVendedores", CommandType.StoredProcedure) DataAdapter("PA_Vta_MetasVendedores", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -4372,6 +4373,7 @@ Public Class ClsVentas
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@GrupoSuperior", SqlDbType.Int).Value = GrupoSuperior
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -1621,7 +1621,6 @@ Partial Class Compras_Compras
' 'End If ' 'End If
'End If 'End If
'RegistraScript("ScrollVentanaAddProducto();") 'RegistraScript("ScrollVentanaAddProducto();")
End Sub End Sub
@@ -8070,7 +8069,7 @@ Partial Class Compras_Compras
Msg.AppendFormat("<br/><br/><a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IdPoliza) Msg.AppendFormat("<br/><br/><a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IdPoliza)
End If End If
If CveMovimientoInventario > 0 Then If CveMovimientoInventario > 0 Then
Dim TempParametros = Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoInventario)) Dim TempParametros = Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoInventario))
Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Ver Movimiento de Almacen</a>", CveMovimientoInventario) Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Ver Movimiento de Almacen</a>", CveMovimientoInventario)
Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Entrada Almacen</a>", TempParametros) Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Entrada Almacen</a>", TempParametros)

View File

@@ -397,8 +397,8 @@ Partial Class Compras_RepComprasDetalle
ImprimirPDF(String.Format("{0}Formatos\Remesa.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Remesa", RDSName:="DsCompras") ImprimirPDF(String.Format("{0}Formatos\Remesa.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Remesa", RDSName:="DsCompras")
End Sub End Sub
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString) 'GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString)
'GenerarPDF("EXCEL") GenerarPDF("EXCEL")
End Sub End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)

View File

@@ -37,12 +37,12 @@
padding-right: 4px !important; padding-right: 4px !important;
padding-left: 4px !important; padding-left: 4px !important;
} }
.Vendedor{ .GrupoSuperior{
background-color:#000077; background-color:#000077;
color:white; color:white;
font-weight:bold; font-weight:bold;
} }
.Vendedor:hover{ .GrupoSuperior:hover{
background-color:#000077; background-color:#000077;
} }
</style> </style>
@@ -121,6 +121,14 @@
<div class="col-md-3"> <div class="col-md-3">
<asp:DropDownList ID="DdlCliente" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveCliente" DataTextField="NombreComercial"></asp:DropDownList> <asp:DropDownList ID="DdlCliente" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveCliente" DataTextField="NombreComercial"></asp:DropDownList>
</div> </div>
<label class="col-md-1 text-right">Grupo: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlGrupo" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%">
<asp:ListItem Value="0" Text="Por Vendedor"></asp:ListItem>
<asp:ListItem Value="1" Text="Por Sucursal"></asp:ListItem>
<asp:ListItem Value="2" Text="General"></asp:ListItem>
</asp:DropDownList>
</div>
</div> </div>
</div> </div>
@@ -183,6 +191,21 @@
<asp:Label ID="lblObjAcumulado" runat="server" Target="_blank" Text='<%# Eval("ObjAcumulado").ToString() %>'> </asp:Label> <asp:Label ID="lblObjAcumulado" runat="server" Target="_blank" Text='<%# Eval("ObjAcumulado").ToString() %>'> </asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="%Var vs AA" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblVarVSAAPerc" runat="server" Target="_blank" Text='<%# Eval("VarVSAAPerc").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Var vs AA" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblVarVSAA" runat="server" Target="_blank" Text='<%# Eval("VarVSAA").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Var vs ObjAcum" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblVarVSObjAcum" runat="server" Target="_blank" Text='<%# Eval("VarVSObjAcum").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>

View File

@@ -60,7 +60,7 @@ Partial Class MetasVendedores
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetRepMetasVendedores(TxtFechaMes.Text, UsuarioActual.CveEmpresa, DdlVendedorFiltro.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero, If ObjVentas.GetRepMetasVendedores(TxtFechaMes.Text, UsuarioActual.CveEmpresa, DdlVendedorFiltro.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero,
DdlClasificaciones.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, DdlMarcaFiltro.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, DdlMarcaFiltro.SelectedValue.ToEntero,
DdlSubProyectoFiltro.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero) Then DdlSubProyectoFiltro.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, DdlGrupo.SelectedValue.ToEntero) Then
GV.DataSource = ObjVentas.DtResultados GV.DataSource = ObjVentas.DtResultados
DtDatos = ObjVentas.DtResultados DtDatos = ObjVentas.DtResultados
End If End If
@@ -75,9 +75,21 @@ Partial Class MetasVendedores
Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCLabel("lblRealMesPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealMesPorcentaje").Text, "%")
e.Row.FCLabel("lblVarVSAAPerc").Text = String.Format("{0}{1}", e.Row.FCLabel("lblVarVSAAPerc").Text, "%")
Select Case e.Row.DataKey("Etiqueta") Select Case e.Row.DataKey("Etiqueta")
Case "Vendedor" Case "GrupoSuperior"
e.Row.CssClass = "Vendedor" e.Row.CssClass = "GrupoSuperior"
e.Row.FCLabel("lblRealMes").Text = ""
e.Row.FCLabel("lblVtaMesAA").Text = ""
e.Row.FCLabel("lblObjMes").Text = ""
e.Row.FCLabel("lblRealAcumulado").Text = ""
e.Row.FCLabel("lblRealMesPorcentaje").Text = ""
e.Row.FCLabel("lblAAntAcumulado").Text = ""
e.Row.FCLabel("lblObjAcumulado").Text = ""
e.Row.FCLabel("lblVarVSAAPerc").Text = ""
e.Row.FCLabel("lblVarVSAA").Text = ""
e.Row.FCLabel("lblVarVSObjAcum").Text = ""
Case "Categoria" Case "Categoria"
e.Row.CssClass = "Totales" e.Row.CssClass = "Totales"
Case "Clasificacion" Case "Clasificacion"

View File

@@ -225,8 +225,8 @@
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:RadioButtonList runat="server" ID="RblTipoCambio" AutoPostBack="true"> <asp:RadioButtonList runat="server" ID="RblTipoCambio" AutoPostBack="true">
<asp:ListItem Text="Moneda Original" Value="1"></asp:ListItem> <asp:ListItem Selected="true" Text="Moneda Original" Value="2"></asp:ListItem>
<asp:ListItem Selected="true" Text="Dólares en Tipo Cambio de la Fecha Venta" Value="2"></asp:ListItem> <asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" Value="1"></asp:ListItem>
<%--<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>--%> <%--<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>--%>
</asp:RadioButtonList> </asp:RadioButtonList>
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false"> <div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">

View File

@@ -107,11 +107,11 @@ Partial Class Ventas_RepIngresos
Dim Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM) Dim Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM)
Dim TiposDoc As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) Dim TiposDoc As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then 'If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then
TCEspecifico = TxtEspecifico.Text.ToDecimal ' TCEspecifico = TxtEspecifico.Text.ToDecimal
Else 'Else
TCEspecifico = -1 ' TCEspecifico = -1
End If 'End If
Dim ObjRepI As New ClsVentas() Dim ObjRepI As New ClsVentas()
If ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TiposDoc, Cves_Subprotectos, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then If ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TiposDoc, Cves_Subprotectos, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then
@@ -174,20 +174,20 @@ Partial Class Ventas_RepIngresos
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("TipoAmortizacion") = "" Then If e.Row.DBCampo("TipoAmortizacion") = "" Then
e.Row.CssClass = "Totales" e.Row.CssClass = "Totales"
ElseIf e.Row.DBCampo("TipoAmortizacion") <> "" AndAlso e.Row.DBCampo("CveConceptoContable") = "-1" Then ElseIf e.Row.DBCampo("TipoAmortizacion") <> "" AndAlso e.Row.DBCampo("CveConceptoContable") = "" Then
e.Row.CssClass = "SubTotales" e.Row.CssClass = "SubTotales"
End If End If
End If End If
End Sub End Sub
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
TipoCambio = RblTipoCambio.SelectedValue.ToEntero TipoCambio = RblTipoCambio.SelectedValue.ToEntero
If TipoCambio = 3 Then 'If TipoCambio = 3 Then
LiEspecifico.Visible = True ' LiEspecifico.Visible = True
TCEspecifico = GlobalTipoCambio(Now).ToDecimal ' TCEspecifico = GlobalTipoCambio(Now).ToDecimal
TxtEspecifico.Text = TCEspecifico.ToString ' TxtEspecifico.Text = TCEspecifico.ToString
Else 'Else
LiEspecifico.Visible = False ' LiEspecifico.Visible = False
End If 'End If
UpBodyTipoCambio.Update() UpBodyTipoCambio.Update()
End Sub End Sub
Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click

View File

@@ -9344,7 +9344,7 @@ Partial Class Ventas
Dim CveTipoRetencion As Integer = 0 Dim CveTipoRetencion As Integer = 0
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero() CveTipoRetencion = factura.CveTipoRetencion
End If 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) 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)
@@ -21486,13 +21486,22 @@ Partial Class Ventas
End If End If
End If End If
DdlTipoComprobante.SelectedValue = "Egs" DdlTipoComprobante.SelectedValue = "Egs"
Dim AplicaImpuestosLocales As Boolean = False
AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked) Dim ObjCliente As New ClsClientes
If ObjCliente.GetClienteImpuestosLocales(CveCliente) Then
'se cargan impuestos locales
Dim DtClienteImpuesto As DataTable = ObjCliente.DtResultados.FiltraParametros("Seleccionado = 1", "Orden")
AplicaImpuestosLocales = (DtClienteImpuesto IsNot Nothing AndAlso DtClienteImpuesto.Rows.Count > 0)
End If
ObjCliente.Dispose()
AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales)
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
End Sub End Sub
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False) Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True)
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS Is Nothing Then If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
@@ -21509,6 +21518,12 @@ Partial Class Ventas
End If End If
End If End If
If Not AplicaImpuestosLocales Then
TmpDTImpuestos.Rows.Clear()
GvImpuestosLocales2.DataSource = TmpDTImpuestos
GvImpuestosLocales2.DataBind()
End If
'CREAMOS DT PARA UTILIZAR AL TIMBRAR 'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC() InicializaDTVentasNC()
@@ -21530,13 +21545,13 @@ Partial Class Ventas
If AplicaNCMasiva Then If AplicaNCMasiva Then
If NCDescuento Then If NCDescuento Then
For Each RNC In ListaNCDesc For Each RNC In ListaNCDesc
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True), True, MissingSchemaAction.Ignore) DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore)
Next Next
Else Else
For Each Gvr As GridViewRow In GvCxC.Rows For Each Gvr As GridViewRow In GvCxC.Rows
If Gvr.FCCheckBox("ChkCxC").Checked Then If Gvr.FCCheckBox("ChkCxC").Checked Then
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore) DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore)
'CARGA FACTURA A LA CUAL SE APLICA LA NC 'CARGA FACTURA A LA CUAL SE APLICA LA NC
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal
CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal) CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal)
@@ -21544,7 +21559,7 @@ Partial Class Ventas
Next Next
End If End If
Else Else
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal) DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales)
If EsNCAmortizacion Then If EsNCAmortizacion Then
If DtAnticipoAmortizacion Is Nothing Then If DtAnticipoAmortizacion Is Nothing Then
@@ -21646,7 +21661,7 @@ Partial Class Ventas
GvPS.DataSource = TmpDT GvPS.DataSource = TmpDT
GvPS.DataBind() GvPS.DataBind()
CalculaTotalesVenta(True) CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
TrTipoRelacion.Visible = True TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1") DdlTiposRelacion.SelectedValueExist("1")
@@ -21671,14 +21686,21 @@ Partial Class Ventas
End Sub End Sub
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False) As DataTable Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0 Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
Dim TmpDT As DataTable = Nothing Dim TmpDT As DataTable = Nothing
Dim TmpDTImpuestos As DataTable = Nothing
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetVentaImpuestosLocales(CveVentaNC) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TmpDTImpuestos = ObjVentas.DtResultados.Copy()
End If
End If
If ObjVentas.GetVentaDetalle(CveVentaNC) Then If ObjVentas.GetVentaDetalle(CveVentaNC) Then
TmpDT = ObjVentas.DtResultados TmpDT = ObjVentas.DtResultados.Copy()
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
End If End If
@@ -21708,10 +21730,19 @@ Partial Class Ventas
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100 Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = "" Dim FiltroStr As String = ""
Dim importePuTemp As Decimal = 0 Dim importePuTemp As Decimal = 0
Dim TotalImpuestosLocales As Decimal = 0
If TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then
TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal()
End If
For Each Dr As DataRow In DtImpuestosLocal.Rows For Each Dr As DataRow In DtImpuestosLocal.Rows
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto")) FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal())) importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal()))
If Not AplicaImpuestosLocales Then
importePuTemp = importePuTemp - TotalImpuestosLocales
End If
Dr("ImporteTotal") = importePuTemp.RoundSQL(2) Dr("ImporteTotal") = importePuTemp.RoundSQL(2)
@@ -21728,9 +21759,13 @@ Partial Class Ventas
Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal) Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next Next
Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
If AplicaImpuestosLocales Then
Importe = Importe + TotalImpuestosLocales
End If
'codigo para ajuste de centavo, si el importe total no cuadra con los totales 'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) Dim difTmp As Decimal = Importe - importeNC
If Math.Abs(difTmp) >= 0.01 Then If Math.Abs(difTmp) >= 0.01 Then
'asusto la diferencia en el último concepto 'asusto la diferencia en el último concepto
Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp