diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index ed8ddbc71..d82eed1e6 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -2406,7 +2406,7 @@ Public Class ClsContabilidad Public Function AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza As Integer, CveConcepto As Integer, TipoMovto As Integer, IdCtaContable As Integer, Orden As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveProveedor As Integer, Optional CvePersonal As Integer = -1, - Optional PorcentajeImpuesto As Decimal = 0) As Boolean + Optional PorcentajeImpuesto As Decimal = 0, Optional CveCuenta As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_PlantillasPolizasDetalleAdd") @@ -2423,6 +2423,7 @@ Public Class ClsContabilidad .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal .Add("@PorcentajeImpuesto", SqlDbType.SmallMoney).Value = PorcentajeImpuesto + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta End With Try diff --git a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd index 1e54f4ce6..2b9fa47bf 100644 --- a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd +++ b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd @@ -6,6 +6,7 @@ + diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 0b6332772..5b1f83c44 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -702,7 +702,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163) Then UsaGlobal = False - If CveEmpresa = 140 And Pagina.Contiene("ventas/ventas") Then + If CveEmpresa.Contiene(140, 141) And Pagina.Contiene("ventas/ventas") Then AplicaParaVenta = 1 End If diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 36db104c1..15833e3e0 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4480,8 +4480,8 @@ Partial Class Bancos_IE Else ' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then - Dim GeneraCancelacionEnCero As Boolean = True - If TxtFechaDocumento.Text.ToDate >= TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero + Dim GeneraCancelacionEnCero As Boolean = False + If TxtFechaCancelacion.Text.ToDate <= TxtFechaDocumento.Text.ToDate.LastDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero GeneraCancelacionEnCero = True End If diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 9d90e76a0..7150832a1 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -3748,15 +3748,7 @@ -
- -
- - - -
- -
+
@@ -3768,9 +3760,9 @@
- <%-- - --%> -
+ + +

diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 63d502979..bedc186b0 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6841,20 +6841,20 @@ Partial Class Compras_Compras End If End If Case 6 + PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto"}).Rows + For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto", "IVAPorcentaje"}).Rows If ObjConta.GetRetCuenta(6, RowDetalle("CveClasificacion").ToString().ToEntero()) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero End If End If If importeMN <> 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, - CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza) Then + CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza, PorcentajeImpuesto:=RowDetalle("IVAPorcentaje").ToString.ToDecimal) Then ErrorPrepoliza = True End If End If @@ -13138,49 +13138,43 @@ Partial Class Compras_Compras PnlContadoBancos.Visible = True TxtDocumentoImporte.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "2" ' F y E PnlContadoFyE.Visible = True CargaFuncionariosEmpleados() ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = True - RfvTxtRembolsoModal.Enabled = True + RfvTxtNumeroReembolso.Enabled = True TxtRembolsoNumero.Text = "" - TxtRembolsoModal.Text = "" + TxtNumeroReembolso.Text = "" Case "3" ' Creditos PnlContadoCreditos.Visible = True ChkCreditoMultiple.Visible = True CargaCreditos() - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + RfvTxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "4" ' Deudores PnlContadoDeudores.Visible = True CargaDeudores() ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "5" ' ACREEDORES PnlContadoAcreedores.Visible = True ChkCreditoMultiple.Visible = True CargaAcreedores() - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "6" ' Caja Chica PnlContadoCajaChica.Visible = True TxtDocumentoImporteCaja.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = True - RfvTxtRembolsoModal.Enabled = True - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = True + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" End Select @@ -13188,7 +13182,7 @@ Partial Class Compras_Compras End Sub Protected Sub BtnContado_Click(sender As Object, e As EventArgs) - TxtRembolsoNumero.Text = TxtRembolsoModal.Text + TxtRembolsoNumero.Text = TxtNumeroReembolso.Text RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) End Sub @@ -19683,8 +19677,8 @@ Partial Class Compras_Compras Dim Multiplicador = If(DdlTipoComprobante.SelectedValue = "NC", -1, 1) If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then - tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal - tipoCambioActual = If(DivTC.Visible, TipoCambio.ToDecimal, tipoCambioActual) + 'tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal + tipoCambioActual = TxtTC.Text.ToDecimal Else tipoCambioActual = 1 End If diff --git a/Contabilidad/PlantillasPolizasDetalle.aspx b/Contabilidad/PlantillasPolizasDetalle.aspx index 294b70ce4..3db8c7b0a 100644 --- a/Contabilidad/PlantillasPolizasDetalle.aspx +++ b/Contabilidad/PlantillasPolizasDetalle.aspx @@ -176,7 +176,7 @@ -  > +  > @@ -269,6 +269,8 @@ + +
diff --git a/Contabilidad/PlantillasPolizasDetalle.aspx.vb b/Contabilidad/PlantillasPolizasDetalle.aspx.vb index d97ccd009..7449e664d 100644 --- a/Contabilidad/PlantillasPolizasDetalle.aspx.vb +++ b/Contabilidad/PlantillasPolizasDetalle.aspx.vb @@ -138,9 +138,32 @@ Partial Class Contabilidad_PlantillasPolizasDetalle Private Sub CargaCuenta() DdlCtaContable.Items.Clear() - DdlCtaContable.DataSource = DTCuentasContables - DdlCtaContable.DataBind() + DdlCtaContable.Items.Insert(0, New ListItem("Seleccione", "-1")) + + If UsuarioActual.Empresa.TipoContabilizacion = 2 Then + Dim Conta As New ClsContabilidad + Dim dtt As New DataTable + + If Conta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + dtt = Conta.DtResultados + End If + + Conta.Dispose() + + DdlCuentas.Items.Clear() + DdlCuentas.DataSource = dtt + DdlCuentas.DataBind() + DdlCuentas.Visible = True + DdlCtaContable.Visible = False + Else + + DdlCtaContable.DataSource = DTCuentasContables + DdlCtaContable.DataBind() + End If + + + DdlCuentas.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub Private Sub CargarConcepto() @@ -229,7 +252,8 @@ Partial Class Contabilidad_PlantillasPolizasDetalle If HdnModalidad.Value = "I" Then If CvePlantillaPoliza > 0 Then - If ObjPlantillaPolizaDetalle.AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza, DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlPorcentajeImpuesto.SelectedValue.ToDecimal) Then + If ObjPlantillaPolizaDetalle.AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza, DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlPorcentajeImpuesto.SelectedValue.ToDecimal, +CveCuenta:=DdlCuentas.SelectedValue.ToEntero) Then TxtOrden.Text = "" If Not ChkSeguirAgregando.Checked Then updatatos() diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx index c29f117a8..1cb80a307 100644 --- a/Contabilidad/RegPrePoliza.aspx +++ b/Contabilidad/RegPrePoliza.aspx @@ -303,7 +303,7 @@
- + Cuenta diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index c5b0c6618..6215cdbce 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -322,6 +322,7 @@ Partial Class ContabilidadC_RegPrePoliza .Add("ConceptoContable", Type.GetType("System.String")) .Add("TC", Type.GetType("System.Decimal")) .Add("PorcentajeImpuesto", Type.GetType("System.Decimal")) + .Add("CveCuenta", Type.GetType("System.Int32")) End With End Sub @@ -715,15 +716,20 @@ Partial Class ContabilidadC_RegPrePoliza If drr IsNot Nothing Then IdCuenta = drt("IdCtaContable").ToString.ToEntero CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - 'Cuenta = drr("Nombre").ToString() + NombreCuenta = drr("Nombre").ToString() + 'Cuenta = drr("Nombre").ToString() + NombreCuenta = CodigoCuenta & "
" & NombreCuenta End If EsComodin = 0 End If + If drt("CveCuenta").ToString.ToEntero > 0 Then + NombreCuenta = String.Format("{0}
{1}", drt("Codigo"), drt("Nombre")) + End If + Dim dr As DataRow = DtMovimientos.NewRow dr("IdCuenta") = IdCuenta - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + dr("CodigoCuenta") = NombreCuenta dr("Cuenta") = Cuenta 'TxtCuentaContable.Text dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) dr("Concepto") = TxtObservaciones.Text @@ -737,7 +743,8 @@ Partial Class ContabilidadC_RegPrePoliza dr("CvePersonal") = drt("CvePersonal") dr("CveClasificacion") = -1 dr("MultipleSubProyecto") = drt("MultipleSubProyecto") - dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") + dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") + dr("CveCuenta") = drt("CveCuenta") DtMovimientos.Rows.Add(dr) Next @@ -945,8 +952,8 @@ Partial Class ContabilidadC_RegPrePoliza CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, gvr.DataKey("TC").ToString.ToDecimal, 1), - ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0), - PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal) Then + ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0), + PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then Else MsgError = "No se pudo insertar el detalle de la póliza2" Exit For diff --git a/Inventarios/RecepcionUsados.aspx b/Inventarios/RecepcionUsados.aspx index f5b6dcc47..73a3c86bf 100644 --- a/Inventarios/RecepcionUsados.aspx +++ b/Inventarios/RecepcionUsados.aspx @@ -494,8 +494,8 @@
- <%----%> - <%----%> + +
diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 22e3f17ec..51f377cdc 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1113,62 +1113,67 @@ Partial Class Inventarios_RecepcionUsados FolioInv = Resp.FolioUsado Else - CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, + Dim tCveConcepto As Integer = CveConcepto + If RblUsadosAjuste.SelectedValue = "1" Then 'cuando es garantia, el concepto es de entrada + tCveConcepto = 2 + End If + + CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, tCveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G") If CveMovimiento <= 0 Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Else - FolioInv = ObjInventario.Folio.ToString() + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Else + FolioInv = ObjInventario.Folio.ToString() - For Each Dr As DataRow In DtMovimientos.Rows + For Each Dr As DataRow In DtMovimientos.Rows - If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal - Else - ImporteConcepto = Dr("PU").ToString.ToDecimal - End If + If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then + ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + Else + ImporteConcepto = Dr("PU").ToString.ToDecimal + End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Exit For - End If - - If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then - Mensaje = "Error al actualizar el recibo de los usados" - ErrorMovInv = True - Exit For - End If - - 'si es selectedvalue = 42, es entrada ,3 -salida - Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) - - If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - - If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then - Mensaje = "Error al guardar Movimientos de distribuidor" + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + Mensaje = "Error al guardar los movimientos" ErrorMovInv = True Exit For End If - End If - Next + If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then + Mensaje = "Error al actualizar el recibo de los usados" + ErrorMovInv = True + Exit For + End If - 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC - 'If Not ErrorMovInv Then - ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) - 'End If + 'si es selectedvalue = 42, es entrada ,3 -salida + Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) + + If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + + If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then + Mensaje = "Error al guardar Movimientos de distribuidor" + ErrorMovInv = True + Exit For + End If + + End If + Next + + 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC + 'If Not ErrorMovInv Then + ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) + 'End If + + End If End If - End If - - If Not ErrorMovInv Then + If Not ErrorMovInv Then If Resp IsNot Nothing Then For Each mensaje2 As String In Resp.Mensajes Msg.AppendFormat("
{0}", mensaje2) diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 18dbbe908..d6c0cbaf4 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1146,7 +1146,7 @@ Partial Class ProductosyServicios End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click - If DdlSATPS.SelectedValue = "46920" Then + If DdlSATPS.SelectedValue.Contiene("46920", "0", "-1") AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158, 72, 80, 145) Then Alert("El Producto Servicio SAT con clave '01010101' no es valido, por favor seleccione otro", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -1159,13 +1159,13 @@ Partial Class ProductosyServicios Dim CveClasificacion2 As Integer = DdlClasificacion2.SelectedValue.ToEntero If (TxtCodigo.Text = TxtCodigoBarras.Text AndAlso TxtCodigo.Text <> "") Then - Alert("Los codigos no pueden ser iguales. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Alert("Los códigos no pueden ser iguales. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Return End If If ddlMetodos.SelectedValue = "5" Or ChkSerie.Checked Then If Not (ddlMetodos.SelectedValue = "5" And ChkSerie.Checked) Then - Dim Mensaje As String = If(ddlMetodos.SelectedValue = "5", "Si el método de salida del inventario es 'SerieLote' el producto debe poder aplicar serie", "Si el produco aplica serie el método de inventario debe ser 'SerieLote'") + Dim Mensaje As String = If(ddlMetodos.SelectedValue = "5", "Si el método de salida del inventario es 'Serie' el producto debe poder aplicar serie", "Si el produco aplica serie el método de inventario debe ser 'SerieLote'") Alert(Mensaje) Exit Sub End If @@ -1176,12 +1176,12 @@ Partial Class ProductosyServicios 'End If If UsuarioActual.Empresa.Funcionalidad(265) = "1" And TxtCodigo.Text = "" Then - Alert("El codigo es requerido.", TipoMensaje.MsgAdvertencia) + Alert("El código es requerido.", TipoMensaje.MsgAdvertencia) Return End If If TxtCodigo.Text <> "" AndAlso Not TxtCodigo.Text.Length >= 3 Then - Alert("El codigo tiene que que tener una longitud de al menos 3 digitos.", TipoMensaje.MsgAdvertencia) + Alert("El código tiene que que tener una longitud de al menos 3 digitos.", TipoMensaje.MsgAdvertencia) Return End If @@ -1450,7 +1450,7 @@ Partial Class ProductosyServicios Dim ObjAliasDelete As New ClsProductosServicios Dim TieneError = False - If ObjAliasDelete.RemovePSAlias(GVAlias.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero, GVAlias.Rows(e.RowIndex).DataKey("PSAlias").ToString, -1) Then + If ObjAliasDelete.RemovePSAlias(GVAlias.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero, GVAlias.Rows(e.RowIndex).DataKey("PSAlias").ToString, UsuarioActual.CveUsuario) Then GVAlias.EditIndex = -1 CargarAlias() UPGVAlias.Update() diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index df8d7e78a..05451a07f 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Linq; -using System.ServiceModel; -using System.Text; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Extensiones; -using static Extensiones.ModExtensiones; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.ServiceModel; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using static Extensiones.ModExtensiones; using Microsoft.Reporting.WebForms; -public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas -{ - private DataTable DtVentas - { - get { return (ViewState["DtVentas"] == null) ? null : (DataTable)ViewState["DtVentas"]; } - set { ViewState["DtVentas"] = value; } - } - private int CveVenta - { - get { return (ViewState["CveVenta"] == null) ? -1 : ViewState["CveVenta"].ToString().ToEntero(); } - set { ViewState["CveVenta"] = value; } - } - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - CargaDatos(); - } - } - private void CargaDatos() - { - HdnLigaRefacturar.Value = ""; - - if (Request["CveVenta"] != null) - { - this.CveVenta = Request["CveVenta"].ToString().ToEntero(); - } - - var ObjVentas = new ClsVentas(); - if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) +public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas +{ + private DataTable DtVentas + { + get { return (ViewState["DtVentas"] == null) ? null : (DataTable)ViewState["DtVentas"]; } + set { ViewState["DtVentas"] = value; } + } + private int CveVenta + { + get { return (ViewState["CveVenta"] == null) ? -1 : ViewState["CveVenta"].ToString().ToEntero(); } + set { ViewState["CveVenta"] = value; } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + private void CargaDatos() + { + HdnLigaRefacturar.Value = ""; + + if (Request["CveVenta"] != null) + { + this.CveVenta = Request["CveVenta"].ToString().ToEntero(); + } + + var ObjVentas = new ClsVentas(); + if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) { if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0) @@ -51,42 +51,42 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { DtVentas = ObjVentas.DtResultados.Copy(); - } - } - - ObjVentas.Dispose(); - GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); - - var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); - if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) - { - DivRefacturar.Visible = true; - GvRefacturaciones.DataSource = DtRefacturar; - GvRefacturaciones.DataBind(); - } - - GvDatos.DataBind(); - UPDatos.Update(); - } - protected void BtnValidar_Click(object sender, EventArgs e) - { + } + } + + ObjVentas.Dispose(); + GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); + + var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); + if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) + { + DivRefacturar.Visible = true; + GvRefacturaciones.DataSource = DtRefacturar; + GvRefacturaciones.DataBind(); + } + + GvDatos.DataBind(); + UPDatos.Update(); + } + protected void BtnValidar_Click(object sender, EventArgs e) + { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); - - int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); - string Total = GvRow.DataKey("Total"); - string SubTotal = GvRow.DataKey("SubTotal"); - string Uuid = GvRow.DataKey("FolioFiscal"); - string RFCCliente = GvRow.DataKey("RFCCliente"); - string Folio = GvRow.DataKey("Folio"); - string TipoDocto = GvRow.DataKey("TipoDocto"); - string Nombre = GvRow.DataKey("Nombre"); - if (CveVenta > 0) - { - var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total); + this.CveVenta = -1; + + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + string Total = GvRow.DataKey("Total"); + string SubTotal = GvRow.DataKey("SubTotal"); + string Uuid = GvRow.DataKey("FolioFiscal"); + string RFCCliente = GvRow.DataKey("RFCCliente"); + string Folio = GvRow.DataKey("Folio"); + string TipoDocto = GvRow.DataKey("TipoDocto"); + string Nombre = GvRow.DataKey("Nombre"); + if (CveVenta > 0 && Uuid != "") + { + var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total); if (resp.EnviarAcuse) { Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();"); @@ -94,30 +94,31 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { Alert(resp.Mensaje); - } - - } - CargaDatos(); + } + + } + CargaDatos(); } - protected void BtnValidarRefacturacion_Click(object sender, EventArgs e) - { + protected void BtnValidarRefacturacion_Click(object sender, EventArgs e) + { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); - - int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); - string Total = GvRow.DataKey("Total"); - string SubTotal = GvRow.DataKey("SubTotal"); - string Uuid = GvRow.DataKey("FolioFiscal"); - string RFCCliente = GvRow.DataKey("RFCCliente"); - string Folio = GvRow.DataKey("Folio"); - string TipoDocto = GvRow.DataKey("TipoDocto"); - string Nombre = GvRow.DataKey("Nombre"); - - if (CveVenta > 0) - { + this.CveVenta = -1; + + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + string Total = GvRow.DataKey("Total"); + string SubTotal = GvRow.DataKey("SubTotal"); + string Uuid = GvRow.DataKey("FolioFiscal"); + string RFCCliente = GvRow.DataKey("RFCCliente"); + string Folio = GvRow.DataKey("Folio"); + string TipoDocto = GvRow.DataKey("TipoDocto"); + string Nombre = GvRow.DataKey("Nombre"); + + + if (CveVenta > 0 && Uuid != "") + { var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true); CargaDatos(); if (respuesta.CveEstatus.Contiene(4,5)) @@ -129,7 +130,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas { Alert(respuesta.Mensaje,TipoMensaje.MsgAdvertencia); } - + //if (respuesta.IrARefacturar) //{ // Server.Transfer(respuesta.LigaRefacturacion); @@ -138,46 +139,46 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas //{ // Alert(respuesta.Mensaje); // CargaDatos(); - //} - } - UPDatos.Update(); - - } - private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) - { - HdnLigaRefacturar.Value = ""; - + //} + } + UPDatos.Update(); + + } + private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) + { + HdnLigaRefacturar.Value = ""; + var retorno = new MRespuestaSAT() { Mensaje = "", EnviarAcuse = false, LigaRefacturacion = "", IrARefacturar = false - }; - - var sb = new StringBuilder(); - - string CancelacionAcuse = ""; - DateTime CancelacionFecha = DateTime.Now; - int CveEstatus = 4; - - try - { - var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true); - if (resp != null) + }; + + var sb = new StringBuilder(); + + string CancelacionAcuse = ""; + DateTime CancelacionFecha = DateTime.Now; + int CveEstatus = 4; + + try + { + var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true); + if (resp != null) { - - if (resp.Estado == null) - { - sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible"); - retorno.Mensaje = sb.ToString(); - return retorno; - } - - sb.AppendFormat("Folio Fiscal: {0}
", uuid); - sb.AppendFormat("Codigo Estado: {0}
", resp.CodigoEstatus); - sb.AppendFormat("Estado: {0}
", resp.Estado); - sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); + + if (resp.Estado == null) + { + sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible"); + retorno.Mensaje = sb.ToString(); + return retorno; + } + + sb.AppendFormat("Folio Fiscal: {0}
", uuid); + sb.AppendFormat("Codigo Estado: {0}
", resp.CodigoEstatus); + sb.AppendFormat("Estado: {0}
", resp.Estado); + sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); sb.AppendFormat("Estatus de Cancelación: {0}

", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion); if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test"))) @@ -253,31 +254,31 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } ObjVentas.Dispose(); } - } - } - else - { - sb.Append("No se pudo comprobar la vigencia de la factura."); + } + } + else + { + sb.Append("No se pudo comprobar la vigencia de la factura."); retorno.Mensaje = sb.ToString(); - return retorno; - } - } - catch (Exception ex) - { + return retorno; + } + } + catch (Exception ex) + { sb.Append("Error al consumir el servicio: " + ex.Message); retorno.Mensaje = sb.ToString(); - return retorno; - } - - retorno.CveEstatus = CveEstatus; - + return retorno; + } + + retorno.CveEstatus = CveEstatus; + retorno.Mensaje = sb.ToString(); - return retorno; - } - private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) - { - Modelos.Factura.MCancelacionVentaMensaje retorno = null; - var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true); + return retorno; + } + private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) + { + Modelos.Factura.MCancelacionVentaMensaje retorno = null; + var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true); if (EsRefacturacion) { retorno = factura.CancelarPorRefacturacion(); @@ -285,63 +286,63 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse); - } - - return retorno; - } - - private string DecodeBase64(string strXMLCodificado) - { - try - { - byte[] decbuff = Convert.FromBase64String(strXMLCodificado); - return System.Text.Encoding.UTF8.GetString(decbuff); - } - catch - { - return ""; - } - } - - protected void LnkValidar_Click(object sender, EventArgs e) + } + + return retorno; + } + + private string DecodeBase64(string strXMLCodificado) + { + try + { + byte[] decbuff = Convert.FromBase64String(strXMLCodificado); + return System.Text.Encoding.UTF8.GetString(decbuff); + } + catch + { + return ""; + } + } + + protected void LnkValidar_Click(object sender, EventArgs e) { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - if (DtVentas != null) - { - var sb = new StringBuilder(); - foreach (DataRow Row in DtVentas.Rows) - { - int CveVenta = Row["CveVenta"].ToEntero(); - string Total = Row["Total"].ToString(); - string SubTotal = Row["SubTotal"].ToString(); - string Uuid = Row["FolioFiscal"].ToString(); - string RFCCliente = Row["RFCCliente"].ToString(); - string Folio = Row["Folio"].ToString(); - string TipoDocto = Row["TipoDocto"].ToString(); - string Nombre = Row["Nombre"].ToString(); - int CveCliente = Row["CveCliente"].ToEntero(); - if (CveVenta > 0) - { - sb.AppendFormat("{0}
", VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, SubTotal)); - } - } - Alert(sb.ToString()); - } - CargaDatos(); - } - - protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) - { - e.Row.Cells[10].Text = ""; - } - } - } + this.CveVenta = -1; + + if (DtVentas != null) + { + var sb = new StringBuilder(); + foreach (DataRow Row in DtVentas.Rows) + { + int CveVenta = Row["CveVenta"].ToEntero(); + string Total = Row["Total"].ToString(); + string SubTotal = Row["SubTotal"].ToString(); + string Uuid = Row["FolioFiscal"].ToString(); + string RFCCliente = Row["RFCCliente"].ToString(); + string Folio = Row["Folio"].ToString(); + string TipoDocto = Row["TipoDocto"].ToString(); + string Nombre = Row["Nombre"].ToString(); + int CveCliente = Row["CveCliente"].ToEntero(); + if (CveVenta > 0) + { + sb.AppendFormat("{0}
", VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, SubTotal)); + } + } + Alert(sb.ToString()); + } + CargaDatos(); + } + + protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) + { + e.Row.Cells[10].Text = ""; + } + } + } public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e) { if (this.CveVenta > 0) @@ -353,7 +354,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas Alert("No se encontro la factura para enviar el acuse", TipoMensaje.MsgAdvertencia); } } - + public void ImprimeCancelacion(int CveVenta) { var Archivo = new System.IO.FileInfo(ModExtensiones.DirectorioBaseEmpresas + @"Empresas\Grales\Formatos\AcuseCancelacion.rdlc"); @@ -457,7 +458,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } } -} +} public class MRespuestaSAT { public int CveEstatus { get; set; } diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d62e04bd5..ce8535aa8 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2582,7 +2582,7 @@ Partial Class Ventas 'DdlEstatus.SelectedValueExist("2") ConfiguraTipoDocto() - CargaFolios() + BtnEmitirImprimir.Text = "Facturar" BtnEmitirImprimir.Visible = True @@ -2615,6 +2615,7 @@ Partial Class Ventas End If If Not ExFolioFactura Then SetPermisos() + If CveVenta < 1 Then CargaFolios() 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE If UsuarioActual.CveVendedor > 0 Then @@ -4819,7 +4820,8 @@ Partial Class Ventas Else BtnGenerarRemision.Visible = False End If - BtnsFacturar.Visible = True + If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) End If End If @@ -5895,7 +5897,7 @@ Partial Class Ventas LnkCotizaciones.Visible = False End If UPCondicionesPago.Update() - ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then + ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then RBLPago.SelectedValue = "1" RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() @@ -5958,7 +5960,7 @@ Partial Class Ventas End If Else - If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then + If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) @@ -5990,6 +5992,9 @@ Partial Class Ventas LnkPedido2SinFacturar.Visible = False LnkCotizaciones.Visible = False LnkOCs.Visible = False + + Else + If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) End If End If UPPCreditoDisponible.Update() @@ -12848,23 +12853,23 @@ Partial Class Ventas 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - If ValorInventario <> 0 Then + ' CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then - OcurrioError = True - End If + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + OcurrioError = True End If + 'End If cont += 1 Next End If IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero() - If TotalCosto <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then + 'If TotalCosto <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then OcurrioError = True End If - End If + 'End If Else OcurrioError = True @@ -15477,7 +15482,7 @@ Partial Class Ventas UpnTools.Update() tdTelefonoGen.Visible = False tdTxtTelefonoGen.Visible = False - If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145) Then + If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145, 140) Then ChkEnviarFactura.Checked = False End If @@ -15870,13 +15875,13 @@ Partial Class Ventas If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA() 'ViewState("SubProyectoPorcentajeIVA") = dr("IVA") ViewState("TipoFormato") = dr("TipoFormato") - ViewState("Serie") = dr("Serie") + 'ViewState("Serie") = dr("Serie") - If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then - LblSerie.Text = SerieVenta - Else - LblSerie.Text = dr("Serie").ToString() - End If + 'If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then + ' LblSerie.Text = SerieVenta + 'Else + ' LblSerie.Text = dr("Serie").ToString() + 'End If If SerieXML <> "" Then LblSerie.Text = SerieXML Dim CveSubProyecto As Integer = GetSubProyectoSucursal() @@ -24909,7 +24914,14 @@ Partial Class Ventas Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() - Dim Obs = RowUsado("CodigoPS").ToString() + Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero() + Dim Obs = "" + 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR + If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then + Obs = RowUsado("CodigoPS").ToString() + Else + Obs = RowUsado("Obs").ToString() + End If If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) @@ -24986,7 +24998,14 @@ Partial Class Ventas Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() - Dim Obs = RowUsado("CodigoPS").ToString() + Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero() + Dim Obs = "" + 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR + If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then + Obs = RowUsado("CodigoPS").ToString() + Else + Obs = RowUsado("Obs").ToString() + End If If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())