Impuestos en remisiones de NC, validacion de cotizaciones

This commit is contained in:
2020-11-06 20:02:12 -07:00
parent 7bf581ec2d
commit d49ea482d8
4 changed files with 718 additions and 371 deletions

View File

@@ -245,7 +245,7 @@
<asp:HyperLink ID="HLOrdenServicio" Target="_blank" runat="server" Visible="false"> <i class="fa fa-plus"></i> Genera O. S.</asp:HyperLink>
</li>
<li>
<asp:LinkButton ID="LkCotizacionAutorizar" Target="_blank" runat="server" Visible="false"> <i class="fa fa-check"></i> Autorizar Cotización</asp:LinkButton>
<asp:LinkButton ID="LkCotizacionAutorizar" runat="server" Visible="false"> <i class="fa fa-check"></i> Autorizar Cotización</asp:LinkButton>
</li>
<li id="LiBuscarPrecio" runat="server" visible="false">
@@ -7099,8 +7099,13 @@
TxtImporte.value = FormatoNumero(Saldo, 2);
}
} else {
TxtImporte.value = "";
Chk.checked = false;
if (SaldoMaximoUtilizable > 0) {
TxtImporte.value = "";
Chk.checked = false;
} else {
TxtImporte.value = FormatoNumero(Saldo, 2);
}
}
} else {

View File

@@ -2167,7 +2167,7 @@ Partial Class Ventas
DdlSubProyectoDatos.Enabled = False
BtnEmitirImprimir.Visible = False
BtnCrearApartirDe.Visible = True
If UsuarioActual.TienePermisoProceso(302) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then BtnEditar.Visible = True
If UsuarioActual.TienePermisoProceso(302) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then BtnEditar.Visible = True
'DdlEstatus.Enabled = True
DivFechaAnticipoCliente.Visible = True
@@ -2222,7 +2222,13 @@ Partial Class Ventas
End If
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
DivDevAlm.Visible = True
Dim ObjInventario As New ClsInventarios
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
DivDevAlm.Visible = True
End If
End If
ObjInventario.Dispose()
End If
@@ -3791,6 +3797,17 @@ Partial Class Ventas
End If
End If
Dim TipoEstatus As Integer = GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {CveEstatus}").ToEntero()
If UsuarioActual.Empresa.Funcionalidad(135) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TipoEstatus = 5 Then
If UsuarioActual.TienePermisoProceso(159) Then
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then
LbCancelarDocumento.Visible = True
End If
End If
End If
'CargaDetalle
If ObjVentas.GetVentaDetalle(CveVenta) Then
TmpDT = ObjVentas.DtResultados
@@ -3885,17 +3902,26 @@ Partial Class Ventas
End If
'Verifico si tiene la funcionalidad (135)
If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
'Reviso cuales son los supervisores
Dim Objeto As New ClsVtaVendedores
If Objeto.GetVendedores(UsuarioActual.CveEmpresa) Then
Dim DTVendedores As New DataTable
DTVendedores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then
DTVendedores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
End If
'Verifico si es su supervisor asignado
If DTVendedores.Rows.Count > 0 Then
LkCotizacionAutorizar.Visible = True
If TipoEstatus = 2 Then
LkCotizacionAutorizar.Visible = False
ElseIf TipoEstatus = 2 Then
LkCotizacionAutorizar.Visible = False
End If
End If
DTVendedores.Dispose()
End If
@@ -4651,6 +4677,41 @@ Partial Class Ventas
End If
GvOCRelacionadas.DataBind()
'Verifico si tiene la funcionalidad (135)
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
'Reviso cuales son los supervisores
Dim ObjVendedores As New ClsVtaVendedores
If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then
Dim DTVendedores As New DataTable
If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then
DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
End If
'Verifico si es su supervisor asignado
If DTVendedores.Rows.Count > 0 Then
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
BtnsFacturar.Visible = True
BtnGenerarRemision.Visible = True
Else
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
End If
DTVendedores.Dispose()
End If
ObjVendedores.Dispose()
End If
If DdlTipoComprobante.SelectedValue = "Cot" Then
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 5 Then
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
End If
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
@@ -10413,7 +10474,7 @@ Partial Class Ventas
If ErrorList.Count = 0 Then
'prepoliza
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento)
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario)
If ErrorList.Count = 0 Then
'INVENTARIOS
@@ -10448,7 +10509,7 @@ Partial Class Ventas
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False,
Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing)
Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing)
Dim CveIE As Integer = -1
Dim DT As DataTable = Nothing
@@ -10467,7 +10528,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" Then
If factura.CvePrePoliza > 0 Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento) Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario) Then
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
@@ -10478,7 +10539,8 @@ Partial Class Ventas
End Sub
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing) As Boolean
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False,
Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing) As Boolean
Try
Dim DT As DataTable
Dim CvePlantilaPoliza As Integer
@@ -11313,12 +11375,43 @@ Partial Class Ventas
IdCtaContableCliente = IdCtaContable
CveCuentaCliente = CveCuenta
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
Dim CveMovimiento As Integer = -1
Dim CveAlmacen As Integer = -1
If ObjInventario IsNot Nothing AndAlso ObjInventario.GetInv_Mov(ObjRNC.CveVenta, UsuarioActual.CveEmpresa) Then
CveMovimiento = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
CveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
End If
'VERIFICA SI TIENE MOVIMIENTO DE ENTRADA DE USADO
If CveMovimiento > 0 AndAlso CveAlmacen > 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Dim SubTotalCalculado As Decimal = (importeMovimiento / (1D + ObjRNC.PorcentajeIVA)).ToDecimal
Dim Importe318 As Decimal = (SubTotalCalculado * ObjRNC.PorcentajeIVA).RoundSQL(2).ToDecimal()
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, SubTotalCalculado, Referencia, 150, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=ObjRNC.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjRNC.CveSubProyecto, ImporteMX:=SubTotalCalculado, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, Contabilizable:=False) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
Else
ErrorPrepoliza = True
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
End If
importeMovimiento = 0
@@ -12724,15 +12817,15 @@ Partial Class Ventas
'TIMBRADO NUEVO
Try
If CveVenta > 0 Then
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
End If
pdf = PdfFactura(ObjFactura)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
End Try
If CveVenta > 0 Then
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
End If
LocalSerieFolio = ObjFactura.SerieFolio
LocalTipoDocto = ObjFactura.TipoDocto
@@ -15780,305 +15873,309 @@ Partial Class Ventas
Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
Return False
End If
If (Obs.Length + PS.Length > 1000) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then
Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
Return False
End If
'VALIDA CONCEPTOS EN CERO - YA SE VALIDA ANTES CON FUNCIONALIDAD - A MIRAS DE ELIMINAR - IPP 28 AGOSTO 2017
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "Ant") Then
If UsuarioActual.CveEmpresa.Contiene(72, 80) AndAlso CveOrdenCompraDetalle = 0 Then ' si viene de una oc, se permiten valores en cero
If Cantidad * PU <= 0 Then
If Not DdlTipoComprobante.SelectedValue = "DPe" Then
Alert("El importe del concepto debe ser mayor a cero. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
End If
End If
Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0
Dim TotalCalculableImpuestosIVA As Decimal = 0
PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
Row = TmpDT.NewRow()
Row("CveProyecto") = CveProyecto
Row("Proyecto") = Proyecto
Row("CveSubProyecto") = CveSubProyecto
Row("SubProyecto") = SubProyecto
Row("Serie") = Serie
Row("TiempoEntrega") = TiempoEntrega
Row("Orden") = TmpDT.Rows.Count + 1
Row("Cantidad") = Cantidad
Row("CveUM") = CveUM
Row("UM") = UM
Row("CveClasificacion") = CveClasificacion
Row("Clasificacion") = Clasificacion
Row("CvePS") = CvePS
Row("Obs") = Obs
Dim DrPS As DataRow = Nothing
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Return False
End If
If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then
'VALIDA CLAVESAT
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA
If DrPS("SATClavePS").ToString() = "" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin producto SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin Unidad Medida SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
End If
If UsuarioActual.CveEmpresa = 72 AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
End If
End If
End If
'verifica si tiene ventaminima
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString()))
Try
If Not CvePS > 0 Then
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
Return False
End If
End If
'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
If Not ClienteDesglosaIEPS Then
If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
VentaDesglosaIEPS = True
If (Obs.Length + PS.Length > 1000) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then
Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
Return False
End If
DrPS("IEPSPorcentaje") = 0
End If
'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
If FacturaDesglosoIEPS Then
VentaDesglosaIEPS = True
End If
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Row("PU") = PU
Row("Codigo") = DrPS("Codigo")
Row("NoIdentificacion") = DrPS("Codigo")
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
If Modalidad = "U" Then
Row("Consec") = Index
Else
Row("Consec") = TmpDT.Rows.Count + 1
End If
Row("PS") = DrPS("PS")
Row("CodigoPS") = DrPS("PSCodigo").ToString()
Row("CveTipoPS") = DrPS("CveTipoPS")
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
Row("CveTamaño") = DrPS("CveTamaño")
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
If DrPS("IVA").ToString().Contiene("-1", "") Then
Row("PorcentajeIVA") = PorcentajeIVA
Else
Row("PorcentajeIVA") = DrPS("IVA")
End If
Dim ClienteRetIVA = Me.ClienteRetIVA
If ClienteRetIVA <= 0 Then
If CBool(DrPS("EsOutSourcing").ToString()) Then
ClienteRetIVA = 0.06D
DdlTipoRetencion.SelectedValueExist("4")
ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
ClienteRetIVA = 0.106667D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
ClienteRetIVA = 0.04D
'VALIDA CONCEPTOS EN CERO - YA SE VALIDA ANTES CON FUNCIONALIDAD - A MIRAS DE ELIMINAR - IPP 28 AGOSTO 2017
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "Ant") Then
If UsuarioActual.CveEmpresa.Contiene(72, 80) AndAlso CveOrdenCompraDetalle = 0 Then ' si viene de una oc, se permiten valores en cero
If Cantidad * PU <= 0 Then
If Not DdlTipoComprobante.SelectedValue = "DPe" Then
Alert("El importe del concepto debe ser mayor a cero. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
End If
End If
End If
LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0
Dim TotalCalculableImpuestosIVA As Decimal = 0
PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
Row = TmpDT.NewRow()
Row("CveProyecto") = CveProyecto
Row("Proyecto") = Proyecto
Row("CveSubProyecto") = CveSubProyecto
Row("SubProyecto") = SubProyecto
Row("Serie") = Serie
Row("TiempoEntrega") = TiempoEntrega
Row("Orden") = TmpDT.Rows.Count + 1
Row("Cantidad") = Cantidad
Row("CveUM") = CveUM
Row("UM") = UM
Row("CveClasificacion") = CveClasificacion
Row("Clasificacion") = Clasificacion
Row("CvePS") = CvePS
Row("Obs") = Obs
Row("IVA") = Row("PorcentajeIVA")
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("PorcentajeRetIVA") = ClienteRetIVA
Row("PorcentajeRetISR") = ClienteRetISR
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("IEPS") = Row("ImporteIEPS")
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = HdnTipoDescuento.Value
Row("CvePromocionDetalle") = CvePromocionDetalle
Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
Dim DrPS As DataRow = Nothing
'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
' Row("IdCtaContVentas") = IdCtaContable
' Row("AplicaParaConcepto") = AplicaParaConcepto
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Return False
End If
If UsuarioActual.Empresa.UsaAC Then
Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
End If
If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then
'VALIDA CLAVESAT
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA
If DrPS("SATClavePS").ToString() = "" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin producto SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin Unidad Medida SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
End If
Row("EntregaDirecta") = EntregaDirecta
'Contratos
Row("CveContratoDetalle") = CveContratoDetalle
Row("CveVentaDetalle") = CveVentaDetalle
Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsOutSourcing") = DrPS("EsOutSourcing")
Row("EsCargo") = EsCargo
If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then
Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString()}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
If UsuarioActual.CveEmpresa = 72 AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
Return False
End If
End If
End If
'ACTIVA PRODUCTOS DE LA MISMA MONEDA
If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString())
CambiaMoneda()
DdlMoneda.Enabled = False
'verifica si tiene ventaminima
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString()))
Return False
End If
End If
End If
'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
If Not ClienteDesglosaIEPS Then
If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
VentaDesglosaIEPS = True
End If
DrPS("IEPSPorcentaje") = 0
End If
'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
If FacturaDesglosoIEPS Then
VentaDesglosaIEPS = True
End If
'RECARGAR GV
TmpDT.Rows.Add(Row)
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Row("PU") = PU
Row("Codigo") = DrPS("Codigo")
Row("NoIdentificacion") = DrPS("Codigo")
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
If Modalidad = "U" Then
Row("Consec") = Index
Else
Row("Consec") = TmpDT.Rows.Count + 1
End If
Row("PS") = DrPS("PS")
Row("CodigoPS") = DrPS("PSCodigo").ToString()
Row("CveTipoPS") = DrPS("CveTipoPS")
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
Row("CveTamaño") = DrPS("CveTamaño")
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
If DrPS("IVA").ToString().Contiene("-1", "") Then
Row("PorcentajeIVA") = PorcentajeIVA
Else
Row("PorcentajeIVA") = DrPS("IVA")
End If
Dim ClienteRetIVA = Me.ClienteRetIVA
If ClienteRetIVA <= 0 Then
If CBool(DrPS("EsOutSourcing").ToString()) Then
ClienteRetIVA = 0.06D
DdlTipoRetencion.SelectedValueExist("4")
ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
ClienteRetIVA = 0.106667D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
ClienteRetIVA = 0.04D
End If
End If
LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
'AGREGA PS ADICIONAL
If UsuarioActual.Empresa.Funcionalidad(561).ToString() = "1" AndAlso Not UsuarioActual.TienePermisoProceso(285) AndAlso GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows.Count > 0 AndAlso Not SeActualiza Then
Row("IVA") = Row("PorcentajeIVA")
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("PorcentajeRetIVA") = ClienteRetIVA
Row("PorcentajeRetISR") = ClienteRetISR
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("IEPS") = Row("ImporteIEPS")
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = HdnTipoDescuento.Value
Row("CvePromocionDetalle") = CvePromocionDetalle
Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
For Each Dr As DataRow In GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows
Dim CvePSAdicional As Integer = Dr("CvePSAdicional").ToString().ToEntero()
Dim DrPoliza As DataRow = TmpDT.NewRow()
DrPoliza.ItemArray = Row.ItemArray
Dim DrPSAdicional = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSAdicional).Rows(0)
If DrPSAdicional IsNot Nothing Then
DrPoliza("CvePS") = CvePSAdicional
DrPoliza("PS") = DrPSAdicional("PS").ToString()
DrPoliza("CveUM") = DrPSAdicional("CveUM").ToString().ToEntero()
DrPoliza("UM") = DrPSAdicional("UnidadMedida").ToString()
DrPoliza("CveClasificacion") = DrPSAdicional("CveClasificacion").ToString().ToEntero()
DrPoliza("Clasificacion") = DrPSAdicional("Clasificacion").ToString()
DrPoliza("CodigoPS") = DrPSAdicional("PSCodigo").ToString()
DrPoliza("CveTipoPS") = DrPSAdicional("CveTipoPS")
DrPoliza("CveTipoInvPS") = DrPSAdicional("Inv_CveMetodoInventario")
DrPoliza("NoIdentificacion") = DrPSAdicional("Codigo")
If Modalidad = "U" Then
DrPoliza("Consec") = Index
Else
DrPoliza("Consec") = TmpDT.Rows.Count + 1
End If
Row("Orden") = TmpDT.Rows.Count + 1
DrPoliza("Cantidad") = If(Dr("Cantidad").ToString().ToDecimal > 0, Dr("Cantidad").ToString().ToDecimal, Cantidad)
PU = 0
'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
' Row("IdCtaContVentas") = IdCtaContable
' Row("AplicaParaConcepto") = AplicaParaConcepto
Dim PrecioSugerido As Decimal = 0
'Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero()
If CvePrecioLista > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=CvePSAdicional) Then
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
If UsuarioActual.Empresa.UsaAC Then
Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
End If
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
Row("EntregaDirecta") = EntregaDirecta
'Contratos
Row("CveContratoDetalle") = CveContratoDetalle
Row("CveVentaDetalle") = CveVentaDetalle
Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsOutSourcing") = DrPS("EsOutSourcing")
Row("EsCargo") = EsCargo
ObjInventarios.Dispose()
Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
ObjPS.Dispose()
If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then
Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString()}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
If PrecioSugerido > 0 Then
PU = PrecioSugerido
'ACTIVA PRODUCTOS DE LA MISMA MONEDA
If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString())
CambiaMoneda()
DdlMoneda.Enabled = False
End If
PU = Math.Round(PU, 6)
DrPoliza("PU") = PU
TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU))
If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then
DrPoliza("PorcentajeIVA") = PorcentajeIVA
Else
DrPoliza("PorcentajeIVA") = DrPSAdicional("IVA")
End If
DrPoliza("IVA") = DrPoliza("PorcentajeIVA")
DrPoliza("ImporteIVA") = Math.Round(DrPoliza("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("PorcentajeRetIVA") = ClienteRetIVA
DrPoliza("PorcentajeRetISR") = ClienteRetISR
DrPoliza("PorcentajeIEPS") = DrPSAdicional("IEPSPorcentaje")
DrPoliza("ImporteIEPS") = Math.Round(DrPSAdicional("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("IEPS") = DrPoliza("ImporteIEPS")
DrPoliza("Descuento") = 0 ' Descuento
DrPoliza("TipoDescuento") = HdnTipoDescuento.Value
DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU)
DrPoliza("TotalImporte") = Math.Round(DrPoliza("Cantidad").ToString().ToDecimal * PU, NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
TmpDT.Rows.Add(DrPoliza)
End If
Next
End If
'RECARGAR GV
TmpDT.Rows.Add(Row)
End If
'AGREGA PS ADICIONAL
If UsuarioActual.Empresa.Funcionalidad(561).ToString() = "1" AndAlso Not UsuarioActual.TienePermisoProceso(285) AndAlso GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows.Count > 0 AndAlso Not SeActualiza Then
For Each Dr As DataRow In GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows
Dim CvePSAdicional As Integer = Dr("CvePSAdicional").ToString().ToEntero()
Dim DrPoliza As DataRow = TmpDT.NewRow()
DrPoliza.ItemArray = Row.ItemArray
Dim DrPSAdicional = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSAdicional).Rows(0)
If DrPSAdicional IsNot Nothing Then
DrPoliza("CvePS") = CvePSAdicional
DrPoliza("PS") = DrPSAdicional("PS").ToString()
DrPoliza("CveUM") = DrPSAdicional("CveUM").ToString().ToEntero()
DrPoliza("UM") = DrPSAdicional("UnidadMedida").ToString()
DrPoliza("CveClasificacion") = DrPSAdicional("CveClasificacion").ToString().ToEntero()
DrPoliza("Clasificacion") = DrPSAdicional("Clasificacion").ToString()
DrPoliza("CodigoPS") = DrPSAdicional("PSCodigo").ToString()
DrPoliza("CveTipoPS") = DrPSAdicional("CveTipoPS")
DrPoliza("CveTipoInvPS") = DrPSAdicional("Inv_CveMetodoInventario")
DrPoliza("NoIdentificacion") = DrPSAdicional("Codigo")
If Modalidad = "U" Then
DrPoliza("Consec") = Index
Else
DrPoliza("Consec") = TmpDT.Rows.Count + 1
End If
Row("Orden") = TmpDT.Rows.Count + 1
DrPoliza("Cantidad") = If(Dr("Cantidad").ToString().ToDecimal > 0, Dr("Cantidad").ToString().ToDecimal, Cantidad)
PU = 0
Dim PrecioSugerido As Decimal = 0
'Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero()
If CvePrecioLista > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=CvePSAdicional) Then
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
ObjPS.Dispose()
End If
End If
If PrecioSugerido > 0 Then
PU = PrecioSugerido
End If
PU = Math.Round(PU, 6)
DrPoliza("PU") = PU
TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU))
If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then
DrPoliza("PorcentajeIVA") = PorcentajeIVA
Else
DrPoliza("PorcentajeIVA") = DrPSAdicional("IVA")
End If
DrPoliza("IVA") = DrPoliza("PorcentajeIVA")
DrPoliza("ImporteIVA") = Math.Round(DrPoliza("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("PorcentajeRetIVA") = ClienteRetIVA
DrPoliza("PorcentajeRetISR") = ClienteRetISR
DrPoliza("PorcentajeIEPS") = DrPSAdicional("IEPSPorcentaje")
DrPoliza("ImporteIEPS") = Math.Round(DrPSAdicional("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
DrPoliza("IEPS") = DrPoliza("ImporteIEPS")
DrPoliza("Descuento") = 0 ' Descuento
DrPoliza("TipoDescuento") = HdnTipoDescuento.Value
DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU)
DrPoliza("TotalImporte") = Math.Round(DrPoliza("Cantidad").ToString().ToDecimal * PU, NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
TmpDT.Rows.Add(DrPoliza)
End If
Next
End If
Retorno = True
Catch ex As Exception
Retorno = False
OnError("Ocurrió un error al agregar el producto/servicio", ex)
End Try
Retorno = True
Return Retorno
End Function
@@ -19549,8 +19646,19 @@ Partial Class Ventas
LBDevolucionAlmacen.ToolTip = "¿Está seguro de Solicitar la Devolución de Almacén?"
End If
If VentaSaldoAlmacen < 0 Then
If DevolucionAlmacen = 0 Then
LBAplicaDevolucion.Visible = True
ElseIf DevolucionAlmacen.Contiene(1, 2) Then
LBAplicaDevolucion.Visible = False
End If
ElseIf VentaSaldoAlmacen >= 0 Then
LBAplicaDevolucion.Visible = False
End If
End If
UpnTools.Update()
'UpInvDev.Update()
End Sub
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
@@ -19578,8 +19686,9 @@ Partial Class Ventas
ObjVentas.Dispose()
Me.DevolucionAlmacen = EstatusDevolucion
InicializaDevolucionAlmacen()
UpnTools.Update()
'UpnTools.Update()
End Sub
@@ -20250,8 +20359,21 @@ Partial Class Ventas
End Sub
Private Sub LkCotizacionAutorizar_Click(sender As Object, e As EventArgs) Handles LkCotizacionAutorizar.Click
EsSupervisor = True
GeneraPDFCotizacion(True)
Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail)
Dim ActualizoEstatus As Boolean = False
Dim ObjVentas As New ClsVentas
If ObjVentas.UpdateEstatusFactura(8, FolioFiscal, "", Now, CveVenta) Then
ActualizoEstatus = True
End If
ObjVentas.Dispose()
If ActualizoEstatus Then
'GeneraPDFCotizacion(True)
Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail)
Else
Alert("No se pudo autorizar la cotización", TipoMensaje.MsgError)
End If
End Sub
#End Region