@@ -7231,7 +7231,8 @@
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
$get("HdnTipoDescuento").value = "3";
- var Total = ToDouble($get('TxtSubTotal').value);
+ //si es con.nc,es.el.total
+ var Total = ToDouble($get(TipoAnticipo == 2? 'TxtTotal':'TxtSubTotal').value);
var SaldoCompra = parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (ToDouble($get('HdnCveVenta').value) == 0) SaldoCompra = Total;
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index e828f93c6..f2e53e0e0 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -1311,36 +1311,36 @@ Partial Class Ventas
ViewState("DtContratosSerieDetalle") = value
End Set
End Property
- Private Property CvePSSerieLote As Integer
+ Private Property CvePSSerie As Integer
Get
- Return CType(ViewState("CvePSSerieLote"), Integer)
+ Return CType(ViewState("CvePSSerie"), Integer)
End Get
Set(value As Integer)
- ViewState("CvePSSerieLote") = value
+ ViewState("CvePSSerie") = value
End Set
End Property
- Private Property CveUMSerieLote As Integer
+ Private Property CveUMSerie As Integer
Get
- Return CType(ViewState("CveUMSerieLote"), Integer)
+ Return CType(ViewState("CveUMSerie"), Integer)
End Get
Set(value As Integer)
- ViewState("CveUMSerieLote") = value
+ ViewState("CveUMSerie") = value
End Set
End Property
- Private Property CveConsecSerieLote As Integer
+ Private Property CveConsecSerie As Integer
Get
- Return CType(ViewState("CveConsecSerieLote"), Integer)
+ Return CType(ViewState("CveConsecSerie"), Integer)
End Get
Set(value As Integer)
- ViewState("CveConsecSerieLote") = value
+ ViewState("CveConsecSerie") = value
End Set
End Property
- Private Property LimitaCantidadSerieLote As Integer
+ Private Property LimitaCantidadSerie As Integer
Get
- Return CType(ViewState("LimitaCantidadSerieLote"), Integer)
+ Return CType(ViewState("LimitaCantidadSerie"), Integer)
End Get
Set(value As Integer)
- ViewState("LimitaCantidadSerieLote") = value
+ ViewState("LimitaCantidadSerie") = value
End Set
End Property
@@ -2591,7 +2591,7 @@ Partial Class Ventas
TrPedido.Visible = False
' TrKilometrajeTxt.Visible = True
End If
- LtlTareaNueva.Text = String.Format(" Tarea", CveVenta)
+ LtlTareaNueva.Text = String.Format(" Tarea", CveVenta)
End If
@@ -3379,17 +3379,17 @@ Partial Class Ventas
'Si es contrato flexible le damos una cantidad alta de lo contrario lo maximo es lo estipulado en el contrato
If e.Row.DataKey("LimitarCantidad").ToString() = "True" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or e.Row.DataKey("ModalidadDetalle").ToString() = "1" Then
e.Row.FCRangeValidator("RVCant").MaximumValue = CantidadDisponible
- LimitaCantidadSerieLote = 1
+ LimitaCantidadSerie = 1
Else
e.Row.FCRangeValidator("RVCant").MaximumValue = "10000000"
- LimitaCantidadSerieLote = 0
+ LimitaCantidadSerie = 0
End If
'CONSIGNACION DE VENTA
If CveAlmacenExistenciasContrato > 0 And e.Row.DBCampo("Inv_CveMetodoInventario").ToString().ToEntero() = 5 Then
GvContratoDetalles.Columns(8).Visible = True
e.Row.FCButton("BtnSerieConsignacion").Visible = True
- e.Row.FCButton("BtnSerieConsignacion").CommandArgument = $"{e.Row.DBCampo("CveContratoDetalle")}°{e.Row.DBCampo("CvePS")}°{e.Row.DBCampo("CveUM")}°{e.Row.DBCampo("CodigoPS")}°{e.Row.DBCampo("Cantidad")}°{LimitaCantidadSerieLote}"
+ e.Row.FCButton("BtnSerieConsignacion").CommandArgument = $"{e.Row.DBCampo("CveContratoDetalle")}°{e.Row.DBCampo("CvePS")}°{e.Row.DBCampo("CveUM")}°{e.Row.DBCampo("CodigoPS")}°{e.Row.DBCampo("Cantidad")}°{LimitaCantidadSerie}"
e.Row.FCTextBox("TxtCant").Enabled = False
End If
@@ -7752,6 +7752,19 @@ Partial Class Ventas
'GENERO LOS DATOS DE LA NC
Dim tmpcon As DataTable = TmpDT.Clone
tmpcon.Clear()
+ Dim DtImpuestos As New DataTable
+ DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
+ DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
+ DtImpuestos.AcceptChanges()
Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPSAnt.SelectedValue.ToEntero()).FiltroPrimero("")
@@ -7760,51 +7773,71 @@ Partial Class Ventas
Dim CveVentaP As Integer = 0
For Each gvrt As GridViewRow In GVAnticipos.Rows
If gvrt.FCCheckBox(String.Format("Chk{0}", gvrt.RowIndex)).Checked Then
+
+
Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero()
Dim dr As DataRow = tmpcon.NewRow
Dim Cantidad As Decimal = 1
- Dim PU As Decimal = gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal
- Dim TotalCalculableImpuestos As Decimal = (Cantidad * (PU))
- dr("CvePS") = drpss("CvePS")
- dr("PS") = drpss("PS")
- dr("OBS") = drpss("PS")
- dr("PU") = PU
- dr("Cantidad") = Cantidad
- dr("CveUM") = drpss("CveUnidadMedida")
- dr("SATClaveProdServ") = "84111506"
- dr("SATClaveUM") = "ACT"
- dr("Consec") = ii
- If drpss("IVA").ToString() = "-1" Then
- dr("PorcentajeIVA") = PorcentajeIVA ' GlobalDTSubProyectos(-1,cves DrPS("IVA")
- Else
- dr("PorcentajeIVA") = drpss("IVA")
- End If
+ Dim tTipoAmortizacion As Integer = If(DdlTipoAmortizacionAnticipo.SelectedValue = "2", 1, 2)
- dr("IVA") = dr("PorcentajeIVA")
- dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- dr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
- dr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
- dr("PorcentajeRetIVA") = ClienteRetIVA
- dr("PorcentajeRetISR") = ClienteRetISR
- If UsuarioActual.Empresa.Funcionalidad(343) = "1" Then
- dr("PorcentajeIEPS") = drpss("IEPSPorcentaje")
- dr("ImporteIEPS") = Math.Round(drpss("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- Else
- dr("PorcentajeIEPS") = 0 ' DrPS("IEPSPorcentaje")
- dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- End If
- dr("IEPS") = dr("ImporteIEPS")
- dr("Descuento") = Math.Round(0, NumeroDecimales)
- dr("TipoDescuento") = HdnTipoDescuento.Value
- dr("Total") = (Cantidad * PU)
- dr("CveClasificacion") = drpss("CveClasificacion")
- dr("CveSubProyecto") = CveSub
- dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
- CveVentaP = gvrt.DataKey("CveVenta").ToEntero()
- tmpcon.Rows.Add(dr)
- ii += 1
+ DtImpuestos = CargaDtImpuestosNC(gvrt.DataKey("CveVenta").ToString().ToEntero(), gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal, AplicaImpuestosLocales:=True, NCDescuento:=False, NivelTotal:=tTipoAmortizacion)
+
+ Dim query = From ddr In DtImpuestos
+ Group By PorcentajeIVA = ddr("PorcentajeIVA").ToString().ToDecimal,
+ PorcentajeRetIVA = ddr("PorcentajeRetIVA").ToString().ToDecimal,
+ PorcentajeRetISR = ddr("PorcentajeRetISR").ToString().ToDecimal,
+ PorcentajeIEPS = ddr("PorcentajeIEPS").ToString().ToDecimal
+ Into x = Group
+ Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
+ ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
+ ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
+ ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
+ ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
+ ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
+ PorcentajeIVA = PorcentajeIVA,
+ PorcentajeRetIVA = PorcentajeRetIVA,
+ PorcentajeRetISR = PorcentajeRetISR,
+ PorcentajeIEPS = PorcentajeIEPS
+
+ DtImpuestos = query.QueryToDataTable(False)
+ For Each Drr As DataRow In DtImpuestos.Rows
+
+ dr("CvePS") = drpss("CvePS")
+ dr("PS") = drpss("PS")
+ dr("OBS") = drpss("PS")
+ dr("PU") = Drr("ImportePU").ToString().ToDecimal
+ dr("Cantidad") = Cantidad
+ dr("CveUM") = drpss("CveUnidadMedida")
+ dr("SATClaveProdServ") = "84111506"
+ dr("SATClaveUM") = "ACT"
+ dr("Consec") = ii
+
+ dr("PorcentajeIVA") = dr("PorcentajeIVA").ToString().ToDecimal
+
+ dr("IVA") = Drr("PorcentajeIVA")
+ dr("ImporteIVA") = Drr("ImporteIVA").ToString().ToDecimal
+ dr("ImporteRetIVA") = Drr("ImporteRetIVA").ToString().ToDecimal
+ dr("ImporteRetISR") = Drr("ImporteRetISR").ToString().ToDecimal
+ dr("PorcentajeRetIVA") = Drr("PorcentajeRetIVA").ToString().ToDecimal
+ dr("PorcentajeRetISR") = Drr("PorcentajeRetISR").ToString().ToDecimal
+
+ dr("PorcentajeIEPS") = Drr("PorcentajeIEPS").ToString().ToDecimal
+ dr("ImporteIEPS") = Drr("ImporteIEPS").ToString().ToDecimal
+
+
+ dr("IEPS") = Drr("ImporteIEPS").ToString().ToDecimal
+ dr("Descuento") = Math.Round(0, NumeroDecimales)
+ dr("TipoDescuento") = HdnTipoDescuento.Value
+ dr("Total") = Drr("ImporteTotal").ToString().ToDecimal
+ dr("CveClasificacion") = drpss("CveClasificacion")
+ dr("CveSubProyecto") = CveSub
+ dr("TotalImporte") = Drr("ImporteTotal").ToString().ToDecimal
+ CveVentaP = gvrt.DataKey("CveVenta").ToEntero()
+ tmpcon.Rows.Add(dr)
+ ii += 1
+ Next
End If
Next
@@ -10096,71 +10129,81 @@ Partial Class Ventas
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
+ Dim ImporteAnticipo As Decimal = importeMovimiento
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
+ If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
+
IdCtaContable = IdCtaContAnticipos
CveCuenta = CveCuentaAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
ViewState("SeGuardoPrePoliza") = True
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
- ErrorPrepoliza = True
- Exit For
- End If
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
'se hace acreditamiento de impuestos
'IVA X TRASLADAR
- Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
- '' si se esta aplicando NC por amortizaion, se trasladan impuestos
- If EsNCAmortizacion Then
- Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
- Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
- Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
+ Dim EsAnticipoEspecial As Boolean = False
- If IngresoIVA > 0 Then
+ If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
+ If EsAnticipoEspecial Then
+ Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
+ '' si se esta aplicando NC por amortizaion, se trasladan impuestos
+ If EsNCAmortizacion Then
+ Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
+ Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
+ Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
- IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- 'IVA PAGADO
- IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
+ If IngresoIVA > 0 Then
-
- If IngresoIEPS > 0 Then
- 'IEPS X TRASLADAR
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+ IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ 'IVA PAGADO
+ IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
- 'IEPS PAGADO
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+
+ If IngresoIEPS > 0 Then
+ 'IEPS X TRASLADAR
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+
+ 'IEPS PAGADO
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
End If
End If
- End If
- End If
+
+ End If
+ End If
+
+ End If
End If
- End If
Next
End If
@@ -11200,7 +11243,7 @@ Partial Class Ventas
CveUnidad = Dr("CveUM").ToString().ToEntero()
Cantidad = Dr("Cantidad").ToString().ToDouble
- If Dr("CveTipoInvPS").ToString().ToEntero() = 5 And Dr("SerieLote").ToString() = "" Then
+ If Dr("CveTipoInvPS").ToString().ToEntero() = 5 And Dr("Serie").ToString() = "" Then
OcurrioError = True
ErrorList.Add("Se deben especificar las Series de los productos de almacén")
Exit For
@@ -11240,7 +11283,7 @@ Partial Class Ventas
End If
End If
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=Dr("SerieLote").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario. ")
Exit For
@@ -11996,7 +12039,12 @@ Partial Class Ventas
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
If CveVenta <= 0 Then
- saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal
+ If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then 'cuando es por NC, debe de tomar el total de su saldo respectivo
+ saldo = e.Row.DataKey("SaldoConImpuestos").ToString().ToDecimal
+ Else
+ saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal
+ End If
+
e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero
End If
@@ -13240,7 +13288,7 @@ Partial Class Ventas
Protected Function CancelarMovimientoInventario(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, CveVentaNueva As Integer, CveVentaVieja As Integer) As Boolean
'SI YA ESTA QUEMADA DE ALMACEN LA VENTA, NO SE CANCELAN LOS MOVIMIENTOS DE INVENTARIO
- If ObjInventario.GetEstatusVentaPorSurir(CveVentaVieja) Then
+ If ObjInventario.GetEstatusVentaPorSurtir(CveVentaVieja) Then
If ObjInventario.EsDevolucionVenta = 2 Then
Return True
End If
@@ -13279,12 +13327,15 @@ Partial Class Ventas
Dim CveUnidad As Integer = MovDet("CveUM").ToString().ToEntero()
Dim PU As Decimal = MovDet("PU").ToString().ToDecimal
Dim CveProducto As Integer = MovDet("CvePS").ToString().ToEntero()
- Dim SerieLote As String = MovDet("SerieLote").ToString()
+ Dim Serie As String = MovDet("Serie").ToString()
+ Dim Lote As String = MovDet("Lote").ToString()
+ Dim FechaCaducidad As Date = MovDet("FechaCaducidad").ToString().ToDate
+
Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString().ToEntero()
'Entrada
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle) Then
OcurrioError = True
Exit For
End If
@@ -13292,7 +13343,7 @@ Partial Class Ventas
'Salida
CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString().ToEntero()
If CveVentaDetalle > 0 Then
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle) Then
OcurrioError = True
Exit For
End If
@@ -14576,7 +14627,7 @@ Partial Class Ventas
AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text,
- SerieLote:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
+ Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
CalculaUsados()
@@ -14706,7 +14757,7 @@ Partial Class Ventas
Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
PU As Decimal, Descuento As Decimal,
CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
- Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
+ Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0,
@@ -14745,7 +14796,7 @@ Partial Class Ventas
Row("Proyecto") = Proyecto
Row("CveSubProyecto") = CveSubProyecto
Row("SubProyecto") = SubProyecto
- Row("SerieLote") = SerieLote
+ Row("Serie") = Serie
Row("TiempoEntrega") = TiempoEntrega
Row("Orden") = TmpDT.Rows.Count + 1
Row("Cantidad") = Cantidad
@@ -15021,7 +15072,7 @@ Partial Class Ventas
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
- TmpDT.Columns.Add("SerieLote", GetType(String))
+ TmpDT.Columns.Add("Serie", GetType(String))
TmpDT.Columns.Add("CuentaPredial", GetType(String))
TmpDT.Columns.Add("Obs", GetType(String))
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
@@ -16136,7 +16187,7 @@ Partial Class Ventas
'Si no se ha terminado de surtir agregamos el movimiento
If Indice >= 0 Then
- ' rowSurtidos("Surtido").ToString().ToDouble < rowSurtidos("Cantidad").ToString().ToDouble AndAlso (dr("CantidadDisponible").ToString().ToDouble - rowSurtidos("Surtido").ToString().ToDouble > 0 Or dr("SerieLote").ToString() <> "")
+ ' rowSurtidos("Surtido").ToString().ToDouble < rowSurtidos("Cantidad").ToString().ToDouble AndAlso (dr("CantidadDisponible").ToString().ToDouble - rowSurtidos("Surtido").ToString().ToDouble > 0 Or dr("Serie").ToString() <> "")
If rowSurtidos("Surtido").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDecimal Then
Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDouble, dr("CantidadDisponible").ToString().ToDecimal, rowSurtidos("Cantidad").ToString().ToDecimal)
MovDTCuadrados.ImportRow(dr)
@@ -16219,7 +16270,10 @@ Partial Class Ventas
Dim CveUnidad As Integer = MovDet("CveUM").ToString().ToEntero()
Dim PU As Decimal = MovDet("PU").ToString().ToDecimal
Dim CveProducto As Integer = MovDet("CvePS").ToString().ToEntero()
- Dim SerieLote As String = MovDet("SerieLote").ToString()
+ Dim Serie As String = MovDet("Serie").ToString()
+ Dim Lote As String = MovDet("Lote").ToString()
+ Dim FechaCaducidad As Date = MovDet("FechaCaducidad").ToString.ToDate
+ Dim CveSeccionAlmacen As Integer = MovDet("CveSeccionAlmacen").ToString.ToEntero
Dim Consec As Integer = DtRemisionesTmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString()}").ToEntero()
'COMIENZA: VENTADETALLE
@@ -16245,7 +16299,7 @@ Partial Class Ventas
CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero()
End If
- If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then
+ If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveSeccionAlmacen:=CVeSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then
ContadorMovtosDetalles += 1
Else
OcurrioError = True
@@ -17208,7 +17262,7 @@ Partial Class Ventas
For Each Row As DataRow In TmpDT.Rows
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero()
If CveVentaDetalle > 0 Then
- If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then
+ If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
@@ -17360,7 +17414,7 @@ Partial Class Ventas
Dim DrProducto As DataRow = Nothing
If TxtCantidad.Text.Trim.ToDouble <= 0 Then TxtCantidad.Text = "1"
- Dim SerieLote As String = ""
+ Dim SerieL As String = ""
Dim CodigoBarras As String = ""
Dim CvePS As Integer
@@ -17369,10 +17423,10 @@ Partial Class Ventas
'BUSCA POR SERIE E IGNORA CODIGO DE BARRAS (LIMPIA)
If TxtCodigoSerie.Text.Trim <> "" Then
- SerieLote = TxtCodigoSerie.Text.Trim().ToUpper()
+ Dim Serie As String = TxtCodigoSerie.Text.Trim().ToUpper()
Dim Objinventarios As New ClsInventarios
- Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, SerieLote:=SerieLote, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero())
- Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", SerieLote))
+ Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, Serie:=Serie, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero())
+ Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Serie))
CvePS = Objinventarios.CvePS
Objinventarios.Dispose()
@@ -17383,11 +17437,11 @@ Partial Class Ventas
HdnCvePS.Value = CvePS.ToString()
TxtCantidad.Text = "1"
Else
- Alert($"No se encontró un producto con la serie: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
+ Alert($"No se encontró un producto con la serie: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
End If
End If
Else
- Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", SerieLote), TipoMensaje.MsgAdvertencia)
+ Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Serie), TipoMensaje.MsgAdvertencia)
TxtCodigoSerie.Focus()
RegistraScript($"$('#{TxtCodigoSerie.ClientID}').select();")
Exit Sub
@@ -17400,7 +17454,7 @@ Partial Class Ventas
CodigoBarras = TxtCodigoBarras.Text.Trim()
DrProducto = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{CodigoBarras}'")
If DrProducto IsNot Nothing Then
- If DrProducto("Inv_CveMetodoInventario").ToString() = "5" Then 'si es serielote
+ If DrProducto("Inv_CveMetodoInventario").ToString() = "5" Then 'si es serie
TxtCodigoSerie.Focus()
Exit Sub
Else
@@ -17410,7 +17464,7 @@ Partial Class Ventas
Else
TxtCodigoBarras.Focus()
RegistraScript($"$('#{TxtCodigoBarras.ClientID}').select();")
- Alert($"No se encontró un producto con el código de barras: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
+ Alert($"No se encontró un producto con el código de barras: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
@@ -17479,7 +17533,7 @@ Partial Class Ventas
'AddPS(TxtCantidad.Text.Trim.ToDouble, DrProducto("CveUM").ToString().ToEntero(), DrProducto("UnidadMedida").ToString(), DrProducto("CveClasificacion").ToString().ToEntero(), DrProducto("Clasificacion").ToString(),
' DrProducto("CvePS").ToString().ToEntero(), DrProducto("PS").ToString(), TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, HdnIVAPS.Value.ToDouble, 0, 0,
' -1, -1, True, DrProducto("Codigo").ToString(), DdlProyecto.SelectedValue.ToEntero(),
- ' DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, DrProducto("CveTipoPS").ToString().ToEntero(), DrProducto("Inv_CveMetodoInventario").ToString().ToEntero(), SerieLote:=SerieLote, CodigoPS:=DrProducto("PSCodigo").ToString())
+ ' DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, DrProducto("CveTipoPS").ToString().ToEntero(), DrProducto("Inv_CveMetodoInventario").ToString().ToEntero(), Serie:=Serie, CodigoPS:=DrProducto("PSCodigo").ToString())
LimpiaAgregar()
End If
@@ -17991,17 +18045,17 @@ Partial Class Ventas
Dim Index = Row.RowIndex
Dim ObjInventarios As New ClsInventarios
Dim Existencia = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString(), ddlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)
- Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString()))
+ Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString()))
'Valida Existencia
If Existencia - ExistenciaActual <= 0 Then
Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Row.FCTextBox("TxtSerie").Text.ToString()), TipoMensaje.MsgAdvertencia)
Row.FCTextBox("TxtSerie").Text = ""
Row.FCHiddenField("HdnSerie").Value = ""
- TmpDT.Rows(Index)("SerieLote") = ""
+ TmpDT.Rows(Index)("Serie") = ""
Else
Row.FCHiddenField("HdnSerie").Value = Row.FCTextBox("TxtSerie").Text
- TmpDT.Rows(Index)("SerieLote") = Row.FCTextBox("TxtSerie").Text
+ TmpDT.Rows(Index)("Serie") = Row.FCTextBox("TxtSerie").Text
End If
TmpDT.AcceptChanges()
@@ -18027,8 +18081,8 @@ Partial Class Ventas
'SIN EXISTENCIA
If Gvr.FCTextBox("TxtSerie").Visible = True And Gvr.FCTextBox("TxtSerie").Text.Trim <> "" Then
- Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero(), SerieLote:=Gvr.FCTextBox("TxtSerie").Text.ToString(), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
- ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
+ Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero(), Serie:=Gvr.FCTextBox("TxtSerie").Text.ToString(), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
+ ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
'Valida Existencia
If Existencia - ExistenciaActual < 0 Then
@@ -18226,13 +18280,13 @@ Partial Class Ventas
DtTemporal.Columns.Add("Lote", Type.GetType("System.String"))
End If
- If Not DtTemporal.Columns.Contains("Batch") Then
- DtTemporal.Columns.Add("Batch", Type.GetType("System.String"))
+ If Not DtTemporal.Columns.Contains("FechaCaducidad") Then
+ DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
End If
- GvInv.Columns(4).Visible = DtTemporal.MAX("SerieLote", "SerieLote <> ''") <> "" Or CveVenta <= 0
+ GvInv.Columns(4).Visible = DtTemporal.MAX("Serie", "Serie <> ''") <> "" Or CveVenta <= 0
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
- GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
+ GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad").ToDate > MinFecha
GvInv.DataSource = DtTemporal
GvInv.DataBind()
@@ -19922,7 +19976,7 @@ Partial Class Ventas
End If
For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros($"ExistenciaPedido > 0 {Filtro}").Rows
AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UnidadMedida").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(),
- dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("SerieLote").ToString(), dr("PU").ToString().ToDecimal, 0.0D,
+ dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("Serie").ToString(), dr("PU").ToString().ToDecimal, 0.0D,
dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(),
CveMovimientoDetallePedido:=dr("CveMovimientoDetalle").ToString().ToEntero())
Next
@@ -20428,12 +20482,12 @@ Partial Class Ventas
If Dr("CveTipoInvPS").ToString().ToEntero() = 5 Then
For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows
- Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, SerieLote:=Dr2("Serie").ToString(), FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
+ Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString(), FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
If Existencia < 1 Then
Return False
End If
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr2("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
End If
Next
@@ -20458,7 +20512,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, Dr("CveAF").ToString().ToEntero(), Dr("CveSeccionAlmacen").ToString().ToEntero(), Dr("SerieLote").ToString(), Lote:=Dr("Lote").ToString(), Batch:=Dr("Batch").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
End If
Next
@@ -20472,7 +20526,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, Dr("CveAF").ToString().ToEntero(), Dr("CveSeccionAlmacen").ToString().ToEntero(), Dr("SerieLote").ToString(), Lote:=Dr("Lote").ToString(), Batch:=Dr("Batch").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
End If
Next
@@ -20506,12 +20560,12 @@ Partial Class Ventas
Protected Sub BtnSerieConsignacion_Click(sender As Object, e As EventArgs)
Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c)
- CveConsecSerieLote = Argumentos(0).ToEntero()
- CvePSSerieLote = Argumentos(1).ToEntero()
- CveUMSerieLote = Argumentos(2).ToEntero()
+ CveConsecSerie = Argumentos(0).ToEntero()
+ CvePSSerie = Argumentos(1).ToEntero()
+ CveUMSerie = Argumentos(2).ToEntero()
LbProducto.Text = Argumentos(3)
LbCantidad.Text = If(Argumentos(4).ToDecimal < 0.0D, 0, Argumentos(4).ToDecimal).FormatoNumero
- LimitaCantidadSerieLote = Argumentos(5).ToEntero()
+ LimitaCantidadSerie = Argumentos(5).ToEntero()
CargaSerie()
End Sub
@@ -20520,11 +20574,11 @@ Partial Class Ventas
Private Sub CargaSerie(Optional CerrarCompletado As Boolean = False)
RegistraScript("$('#DivSerieConsignacion').modal();", "ModalLote")
- GvSerie.DataSource = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote), "Consec DESC")
+ GvSerie.DataSource = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
GvSerie.DataBind()
lblSerieTotal.Text = GvSerie.Rows.Count.ToString()
'VALIDA QUE SIGA AGREGANDO
- If DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote)).Rows.Count = LbCantidad.Text.ToEntero() And LimitaCantidadSerieLote = 1 Then
+ If DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count = LbCantidad.Text.ToEntero() And LimitaCantidadSerie = 1 Then
BtnAgregarPS.Enabled = False
If CerrarCompletado Then
RegistraScript("$('#DivSerieConsignacion').modal('hide');")
@@ -20534,22 +20588,21 @@ Partial Class Ventas
End If
UpSerieConsignacion.Update()
- TxtSerieLote.Text = ""
- TxtSerieLote.Focus()
+ TxtSerie.Text = ""
+ TxtSerie.Focus()
End Sub
Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs)
- AgregaSerieLote(TxtSerieLote.Text.Replace(" ", String.Empty))
+ AgregaSerie(TxtSerie.Text.Replace(" ", String.Empty))
End Sub
- Private Sub AgregaSerieLote(SerieLote As String)
- 'SerieLote = SerieLote.Trim.Replace(" ", " ")
+ Private Sub AgregaSerie(Serie As String)
- If SerieLote.Trim = "" Then
+ If Serie.Trim = "" Then
Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
- Dim SeriesArreglo = SerieLote.Trim.Split(";"c)
+ Dim SeriesArreglo = Serie.Trim.Split(";"c)
'VALIDACION DE SERIES DUPLICADAS
Dim MensajeAlert As New StringBuilder
@@ -20558,13 +20611,13 @@ Partial Class Ventas
DtSeriesNuevas.Columns.Add("Serie", GetType(String))
'PARA VALIDAR SI LA SERIE ES IGUAL AL CODIGO O CODIGOBARRAS
- ' Dim dr As DataRow = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CvePS = {0}", CvePSSerieLote), "PS")
- Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSSerieLote).FiltroPrimero("", "PS")
+ ' Dim dr As DataRow = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CvePS = {0}", CvePSSerie), "PS")
+ Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSSerie).FiltroPrimero("", "PS")
For Each SerieRow In SeriesArreglo
SerieRow = SerieRow.ToUpper
- DtDuplicado = DtContratosSerieDetalle.FiltraParametros($"ConsecId = {CveConsecSerieLote} AND Serie = '{SerieRow}'")
+ DtDuplicado = DtContratosSerieDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{SerieRow}'")
If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then
MensajeAlert.Append($" El numero de Serie ""{SerieRow}"" proporcionado ya se encuentra ingresado.")
Continue For
@@ -20602,29 +20655,29 @@ Partial Class Ventas
Dim Row = DtContratosSerieDetalle.NewRow
Index = Index + 1
- If Index > LbCantidad.Text.ToEntero() And LimitaCantidadSerieLote = 1 Then
+ If Index > LbCantidad.Text.ToEntero() And LimitaCantidadSerie = 1 Then
MensajeSinExistencias.Append($"Serie: {SerieRow} - En esta serie ocurrió un error por favor de comunicarse con soporte tecnico.. ")
Continue For
End If
'VERIFICA EXISTENCIAS
- Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieRow)
+ Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow)
If Existencia < 1 Then
MensajeSinExistencias.Append($"Serie: {SerieRow}. ")
Continue For
End If
- Row("ConsecId") = CveConsecSerieLote
+ Row("ConsecId") = CveConsecSerie
Row("Consec") = DtContratosSerieDetalle.Rows.Count + 1
- Row("CvePS") = CvePSSerieLote
- Row("CveUM") = CveUMSerieLote
+ Row("CvePS") = CvePSSerie
+ Row("CveUM") = CveUMSerie
Row("Serie") = SerieRow
DtContratosSerieDetalle.Rows.Add(Row)
Next
ObjInventarios.Dispose()
- TxtSerieLote.Text = ""
+ TxtSerie.Text = ""
CargaCantidadSerieGV()
@@ -20641,9 +20694,9 @@ Partial Class Ventas
Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting
Try
- Dim keySerieLote As String = e.Keys("Serie").ToString()
+ Dim keySerie As String = e.Keys("Serie").ToString()
For Each dr As DataRow In DtContratosSerieDetalle.Rows
- If dr("Serie").ToString() = keySerieLote Then
+ If dr("Serie").ToString() = keySerie Then
dr.Delete()
End If
Next
@@ -20658,7 +20711,7 @@ Partial Class Ventas
Private Sub CargaCantidadSerieGV()
'MODIFICA CANTIDAD DEL GV CONTRATOS
For Each Gvr As GridViewRow In GvContratoDetalles.Rows
- If Gvr.DataKey("CvePS").ToEntero() = CvePSSerieLote Then
+ If Gvr.DataKey("CvePS").ToEntero() = CvePSSerie Then
Dim Contador = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("CveContratoDetalle"))).Rows.Count
Gvr.FCTextBox("TxtCant").Text = Contador.ToString()
UPEstimaciones.Update()
@@ -21962,13 +22015,13 @@ Partial Class Ventas
If AplicaNCMasiva Then
If NCDescuento Then
For Each RNC In ListaNCDesc
- DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore)
+ DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
Else
For Each Gvr As GridViewRow In GvCxC.Rows
If Gvr.FCCheckBox("ChkCxC").Checked Then
- DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore)
+ DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
'CARGA FACTURA A LA CUAL SE APLICA LA NC
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal
CargaNCDT(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal)
@@ -21976,7 +22029,7 @@ Partial Class Ventas
Next
End If
Else
- DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales)
+ DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
If EsNCAmortizacion Then
If DtAnticipoAmortizacion Is Nothing Then
@@ -21995,7 +22048,7 @@ Partial Class Ventas
End If
Else
For Each RNC In ListaRemisionesNC
- DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore)
+ DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
End If
@@ -22112,12 +22165,13 @@ Partial Class Ventas
End Sub
- Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True) As DataTable
+ Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
Dim TmpDT As DataTable = Nothing
Dim TmpDTImpuestos As DataTable = Nothing
+
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVentaImpuestosLocales(CveVentaNC) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
@@ -22153,7 +22207,7 @@ Partial Class Ventas
DtImpuestosLocal.Columns.Add("ImporteRetISR", GetType(Decimal))
DtImpuestosLocal.Columns.Add("ImporteIEPS", GetType(Decimal))
- Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero() = 1, Total, SubTotal)
+ Dim ImporteReferencia As Decimal = If(NivelTotal = 1, Total, SubTotal)
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = ""
Dim importePuTemp As Decimal = 0
@@ -22212,7 +22266,7 @@ Partial Class Ventas
CveClasificacion As Integer, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
Obs As String, Cantidad As Double, PU As Double, PorcentajeIVA As Double, ImporteIVA As Double, PorcentajeRetIVA As Double, ImporteRetIVA As Double,
PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double,
- Total As Double, SerieLote As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String,
+ Total As Double, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String,
SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer,
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1)
@@ -22258,7 +22312,7 @@ Partial Class Ventas
Row("TotalImporte") = Math.Round(Total, NumeroDecimales)
- Row("SerieLote") = SerieLote
+ Row("Serie") = Serie
Row("TiempoEntrega") = TiempoEntrega
Row("CvePresupuestoIngreso") = CvePresupuestoIngreso
Row("EntregaDirecta") = EntregaDirecta
@@ -23106,8 +23160,14 @@ Partial Class Ventas
End If
- If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then DivConceptoNC.Visible = True Else DivConceptoNC.Visible = False
+ If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
+ 'debo de cambiar la columna que se tomaria como total, por si tiene impuestos, la NC estaria abarcandolos
+ DivConceptoNC.Visible = True
+ Else
+ DivConceptoNC.Visible = False
+ End If
+ CargaAnticipos(CveCliente)
DdlTipoRelacionAnticipo.SelectedValueExist("7")
Else
DivConceptoNC.Visible = False