This commit is contained in:
2019-12-03 18:41:53 -07:00
4 changed files with 27 additions and 17 deletions

View File

@@ -306,6 +306,7 @@ Public Class CFDIConceptos
Public Property ClaveUnidad As String = "" Public Property ClaveUnidad As String = ""
Public Property Impuestos As List(Of CFDIConceptosImpuestos) Public Property Impuestos As List(Of CFDIConceptosImpuestos)
Public Property Descuento As Decimal = 0.00D Public Property Descuento As Decimal = 0.00D
Public Property ImporteGravaIVAAdicional As Decimal = 0.00D 'caso IEPS
Sub New() Sub New()
Impuestos = New List(Of CFDIConceptosImpuestos) Impuestos = New List(Of CFDIConceptosImpuestos)

View File

@@ -2793,7 +2793,7 @@
<a href="javascript;" class="collapse" data-original-title="" title=""></a> <a href="javascript;" class="collapse" data-original-title="" title=""></a>
</div> </div>
</div> </div>
<div class="row"> <div class="row" style="display:none;">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlFacturas" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="SerieFolio" DataValueField="CveVenta" OnSelectedIndexChanged="DdlFacturas_SelectedIndexChanged" Width="100%" AutoPostBack="true"> <asp:DropDownList ID="DdlFacturas" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="SerieFolio" DataValueField="CveVenta" OnSelectedIndexChanged="DdlFacturas_SelectedIndexChanged" Width="100%" AutoPostBack="true">
@@ -2813,8 +2813,8 @@
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPSAjuste" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" OnSelectedIndexChanged="DdlPSAjuste_selectedindexchange" Width="100%" AutoPostBack="true"> <ADS:DropDownLost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange" >
</asp:DropDownList> </ADS:DropDownLost>
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label> <label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
</div> </div>
</div> </div>

View File

@@ -1071,6 +1071,7 @@ Partial Class PV
CargaSucursales() CargaSucursales()
CargaClasificaciones() CargaClasificaciones()
CargaPS(-1, DdlPS) CargaPS(-1, DdlPS)
CargaPS(-1, DdlPSAjuste)
CargaEmpresa() CargaEmpresa()
CreaDTVentas() CreaDTVentas()
CargaMetodosPago() CargaMetodosPago()
@@ -5046,7 +5047,7 @@ Partial Class PV
End Sub End Sub
Private Sub CargaPSAjuste() Private Sub CargaPSAjuste()
DdlPSAjuste.Items.Clear() 'DdlPSAjuste.Items.Clear()
DtPUFacturas.Rows.Clear() DtPUFacturas.Rows.Clear()
If DdlFacturas.SelectedValue.ToEntero > 0 Then If DdlFacturas.SelectedValue.ToEntero > 0 Then
@@ -5064,7 +5065,7 @@ Partial Class PV
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
End If End If
DdlPSAjuste.DataBind() DdlPSAjuste.DataBind()
DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) ' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))
DtPUFacturas.AcceptChanges() DtPUFacturas.AcceptChanges()
UpAjuste.Update() UpAjuste.Update()
CalculaPorcentajeAjuste() CalculaPorcentajeAjuste()
@@ -5099,7 +5100,7 @@ Partial Class PV
TxtPorcentajeAjuste.Text = "" TxtPorcentajeAjuste.Text = ""
TxtPoliza.Text = "" TxtPoliza.Text = ""
TxtImporteAjuste.Text = "" TxtImporteAjuste.Text = ""
DdlPSAjuste.SelectedIndex = -1 DdlPSAjuste.SelectedValue = "-1"
ChkAjuste.Checked = False ChkAjuste.Checked = False
DivAjuste.Visible = False DivAjuste.Visible = False
End Sub End Sub
@@ -5130,7 +5131,7 @@ Partial Class PV
TxtImporteAjuste.Text = Dr("Importe").ToString TxtImporteAjuste.Text = Dr("Importe").ToString
DdlFacturas.SelectedValueExist(Dr("CveVenta").ToString) DdlFacturas.SelectedValueExist(Dr("CveVenta").ToString)
CargaPSAjuste() CargaPSAjuste()
DdlPSAjuste.SelectedValueExist(Dr("CvePS").ToString) DdlPSAjuste.SelectedValue = (Dr("CvePS").ToString)
TxtFechaAjuste.Text = Dr("FechaAjuste").ToString.ToDate.ToShortDateString TxtFechaAjuste.Text = Dr("FechaAjuste").ToString.ToDate.ToShortDateString
TxtPrecio.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2) TxtPrecio.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0 TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
@@ -5164,7 +5165,7 @@ Partial Class PV
Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs) Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs)
If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
Dim Index As Integer = DdlPSAjuste.SelectedIndex
Dim Contador As Integer = 1 Dim Contador As Integer = 1
Dim PUFactura As Decimal = 0 Dim PUFactura As Decimal = 0
For Each Dr As DataRow In DtPUFacturas.Rows For Each Dr As DataRow In DtPUFacturas.Rows
@@ -5177,8 +5178,8 @@ Partial Class PV
End If End If
If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso Not DdlFacturas.SelectedValue.ToEntero > 0 Then If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero <= 0 Then
Dim Index As Integer = DdlPSAjuste.SelectedIndex
Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero
Dim PrecioSugerido As Decimal = 0 Dim PrecioSugerido As Decimal = 0
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
@@ -5189,9 +5190,9 @@ Partial Class PV
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
End If End If
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
TxtPUFactura.Text = "" TxtPUFactura.Text = ""
End If End If
@@ -5207,6 +5208,11 @@ Partial Class PV
End Sub End Sub
Private Sub CalculaPorcentajeAjuste() Private Sub CalculaPorcentajeAjuste()
If DdlPS.SelectedValue.ToEntero <= 0 Then
'Alert("No se ha especificado producto a entregar")
Exit Sub
End If
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
Dim CveMarca As Integer = -1 Dim CveMarca As Integer = -1
If GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows.Count > 0 Then If GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows.Count > 0 Then
@@ -5283,7 +5289,7 @@ Partial Class PV
Row("Importe") = TxtImporteAjuste.Text.ToDouble Row("Importe") = TxtImporteAjuste.Text.ToDouble
Row("ConsecutivoVenta") = ConsecutivoVenta Row("ConsecutivoVenta") = ConsecutivoVenta
Row("CvePS") = DdlPSAjuste.SelectedValue Row("CvePS") = DdlPSAjuste.SelectedValue
Row("PS") = DdlPSAjuste.SelectedItem.Text Row("PS") = DdlPSAjuste.SelectedText
Row("CveVenta") = DdlFacturas.SelectedValue Row("CveVenta") = DdlFacturas.SelectedValue
Row("PUFactura") = TxtPrecio.Text.ToDouble Row("PUFactura") = TxtPrecio.Text.ToDouble
Row("Cantidad") = 1 Row("Cantidad") = 1
@@ -5313,7 +5319,7 @@ Partial Class PV
TmpDTAjustes.Rows(IndexAjuste)("Importe") = TxtImporteAjuste.Text.ToDouble TmpDTAjustes.Rows(IndexAjuste)("Importe") = TxtImporteAjuste.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("ConsecutivoVenta") = ConsecutivoVenta TmpDTAjustes.Rows(IndexAjuste)("ConsecutivoVenta") = ConsecutivoVenta
TmpDTAjustes.Rows(IndexAjuste)("CvePS") = DdlPSAjuste.SelectedValue TmpDTAjustes.Rows(IndexAjuste)("CvePS") = DdlPSAjuste.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PS") = DdlPSAjuste.SelectedItem.Text TmpDTAjustes.Rows(IndexAjuste)("PS") = DdlPSAjuste.SelectedText
TmpDTAjustes.Rows(IndexAjuste)("CveVenta") = DdlFacturas.SelectedValue TmpDTAjustes.Rows(IndexAjuste)("CveVenta") = DdlFacturas.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPrecio.Text.ToDouble TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPrecio.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("Cantidad") = 1 TmpDTAjustes.Rows(IndexAjuste)("Cantidad") = 1

View File

@@ -8544,7 +8544,8 @@ Partial Class Ventas
.ClaveUnidad = drr("SATClaveUM").ToString, .ClaveUnidad = drr("SATClaveUM").ToString,
.ClaveProdServ = drr("SATClaveProdServ").ToString, .ClaveProdServ = drr("SATClaveProdServ").ToString,
.Noidentificacion = drr("Noidentificacion").ToString, .Noidentificacion = drr("Noidentificacion").ToString,
.CuentaPredial = drr("CuentaPredial").ToString} .CuentaPredial = drr("CuentaPredial").ToString,
.ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString.ToDecimal}
'verifica suma subtotales 'verifica suma subtotales
If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales
concepto.Importe = totSubTotal concepto.Importe = totSubTotal
@@ -8556,7 +8557,7 @@ Partial Class Ventas
'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos
If Timbre.Comprobante.Total > 0 Then If Timbre.Comprobante.Total > 0 Then
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
End If End If
If drr("ImporteIEPS").ToString.ToDouble > 0 Then If drr("ImporteIEPS").ToString.ToDouble > 0 Then
@@ -14003,6 +14004,7 @@ Partial Class Ventas
Dim Row As DataRow = Nothing Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0 Dim TotalCalculableImpuestos As Decimal = 0
Dim TotalCalculableImpuestosIVA As Decimal = 0
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
Row = TmpDT.NewRow() Row = TmpDT.NewRow()
@@ -14105,6 +14107,7 @@ Partial Class Ventas
'End If 'End If
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
Row("PU") = PU Row("PU") = PU
Row("Codigo") = DrPS("Codigo") Row("Codigo") = DrPS("Codigo")
@@ -14135,7 +14138,7 @@ Partial Class Ventas
End If End If
Row("IVA") = Row("PorcentajeIVA") Row("IVA") = Row("PorcentajeIVA")
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
Row("PorcentajeRetIVA") = ClienteRetIVA Row("PorcentajeRetIVA") = ClienteRetIVA