diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index c39d24f8f..be86a5e61 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -4747,7 +4747,9 @@ Public Class ClsContabilidad Public Function UpdateCuenta(CveCuenta As Integer, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1, Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveConceptoAdmin As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClasificacion As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1, - Optional CveBancoCuenta As Integer = -1, Optional CveAlmacen As Integer = -1, Optional Afectable As Integer = -1, Optional Codigo As String = "-1") As Boolean + Optional CveBancoCuenta As Integer = -1, Optional CveAlmacen As Integer = -1, Optional Afectable As Integer = -1, Optional Codigo As String = "-1", + Optional CvePadre As Integer = -1) As Boolean + Dim Retorno As Boolean = False DataAdapter("PA_Conta_UpdateCuentas") @@ -4770,6 +4772,8 @@ Public Class ClsContabilidad .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@Afectable", SqlDbType.Int).Value = Afectable .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@CvePadre", SqlDbType.Int).Value = CvePadre + End With diff --git a/Bancos/CuentasBancariasDetalle.aspx.vb b/Bancos/CuentasBancariasDetalle.aspx.vb index 707282855..9576baed7 100644 --- a/Bancos/CuentasBancariasDetalle.aspx.vb +++ b/Bancos/CuentasBancariasDetalle.aspx.vb @@ -99,7 +99,7 @@ Partial Class Bancos_CuentasBancariasDetalle Private Sub CargaCuentasContables() Dim dt As DataTable = Nothing - If UsuarioActual.Empresa.TipoContabilizacion = 1 Then + If UsuarioActual.Empresa.TipoContabilidad = 1 Then Using ObjContabilidad As New ClsContabilidad 'UsuarioActual.Empresa.Funcionalidad(208).ToEntero If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then @@ -122,7 +122,7 @@ Partial Class Bancos_CuentasBancariasDetalle trCuentaContableComplementaria.Visible = True Else - If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then + If UsuarioActual.Empresa.TipoContabilidad = 2 Or UsuarioActual.Empresa.UsaAC Then Dim IdPadre As Integer Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) @@ -212,36 +212,24 @@ Partial Class Bancos_CuentasBancariasDetalle End If Next - If ExisteEnIntems Then DDlCuentaContable.SelectedValueExist(ObjCuentasBancariasDetalle.IdCtaContable.ToString) Else - - If UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.TipoContabilidad = 2 Then Dim objCont As New ClsContPAQi(UsuarioActual.Empresa) - If objCont.GetCuentas(ObjCuentasBancariasDetalle.IdCtaContable, "-1", -1) Then If objCont.DtResultados.Rows.Count > 0 Then DDlCuentaContable.Items.Add(New ListItem(objCont.DtResultados.Rows(0)("CtaCodigo").ToString, objCont.DtResultados.Rows(0)("id").ToString)) DDlCuentaContable.SelectedValueExist(ObjCuentasBancariasDetalle.IdCtaContable.ToString) - End If End If - - objCont.Dispose() - End If - End If - - DdlCuentaContableComplementaria.SelectedValueExist(ObjCuentasBancariasDetalle.IdCtaContableComplementaria.ToString) - - End If Else diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index ee2823cb8..0cd09df4d 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -8372,6 +8372,8 @@ Partial Class Compras_Compras If CveCompra > 0 Then + Dim ObjContaAC As ClsContPAQi = Nothing + 'INICIALIZA OBJETOS If Not (ObjComprasParametro IsNot Nothing And ObjContaParametro IsNot Nothing) Then ObjCompra = New ClsCompras @@ -8478,8 +8480,33 @@ Partial Class Compras_Compras Next + + + If ErrorMovtosCxP = 0 And CvePrePolizaNueva > 0 Then + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC Is Nothing Then + ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjContaAC.IniciaTransacSQL() + End If + + If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveEmpresa, UsuarioActual.Empresa, MinFecha, "", ObjContaAC) Then + ErrorMovtosCxP = 3 + End If + + End If + + End If + Select Case ErrorMovtosCxP Case 0 + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC IsNot Nothing Then + ObjContaAC.Commit() + End If + End If + Alert("El movimiento se aplicó correctamente.", TipoMensaje.MsgInformacion) ObjCompra.Commit() @@ -8501,18 +8528,40 @@ Partial Class Compras_Compras UpAnticipos.Update() UpPS.Update() dtnc.Dispose() + Case 1 Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) ObjCompra.RollBack() Case 2 Alert("Ocurrió un error al amortizar la nota de crédito
Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) + ObjCompra.RollBack() + Case 3 + Alert("Ocurrió un error al contabilizar la la amortizacion del anticipo.", TipoMensaje.MsgAdvertencia) + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjContaAC IsNot Nothing Then + Try + ObjContaAC.RollBack() + Catch ex As Exception + + End Try + End If + End If + ObjCompra.RollBack() End Select Catch ex As Exception ObjCompra.RollBack() End Try + + + If ObjContaAC IsNot Nothing Then + ObjContaAC.Dispose() + End If + ObjCompra.Dispose() + Else 'sino se ha guardado la compra, se registra temporal que anticpos van a cargarle @@ -14290,7 +14339,7 @@ Partial Class Compras_Compras 'SI PUEDE RECIBIR POR OC Y COMPRA ' si usa almacen, si tiene activado que reciba por OC, y que si la compra tipo Proveedor. que lo muestre - If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then + If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then DivOCVinculaInv.Visible = True End If diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 7c5ce2a0e..e771ec2c1 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -4468,6 +4468,9 @@ Partial Class Compras_Proveedores Dim CuentaPadre = -1 + Dim TipoCuenta As String = "D" + + Select Case btn.CommandArgument.ToString Case "Proveedores" CuentaPadre = If(DdlCveTipoProveedor.SelectedValue = "2", UsuarioActual.Empresa.Funcionalidad(202).ToEntero, UsuarioActual.Empresa.Funcionalidad(201).ToEntero) @@ -4477,6 +4480,7 @@ Partial Class Compras_Proveedores CuentaPadre = UsuarioActual.Empresa.Funcionalidad(203).ToEntero Case "Anticipos" CuentaPadre = UsuarioActual.Empresa.Funcionalidad(204).ToEntero + TipoCuenta = "A" Case "Deudores" CuentaPadre = UsuarioActual.Empresa.Funcionalidad(205).ToEntero diff --git a/Compras/RepCompras.aspx b/Compras/RepCompras.aspx index 27dd1c5b4..f094031ad 100644 --- a/Compras/RepCompras.aspx +++ b/Compras/RepCompras.aspx @@ -257,7 +257,7 @@
- + diff --git a/Compras/RepCxPDetalle.aspx.vb b/Compras/RepCxPDetalle.aspx.vb index 84ad7bd28..7538bb0e3 100644 --- a/Compras/RepCxPDetalle.aspx.vb +++ b/Compras/RepCxPDetalle.aspx.vb @@ -406,7 +406,7 @@ Partial Class RepCxPDetalle TMP_DTDatos = ObjMovtos.DtResultados TMP_DTDatos.Columns.Add("Cuenta") - If DdlGrupo.SelectedValue.ToEntero = 5 And UsuarioActual.Empresa.UsaContabilidad Then 'cuando es grupo por proveedor, se muestra la cuneta contable + If DdlGrupo.SelectedValue.ToEntero = 5 And UsuarioActual.Empresa.TipoContabilidad = 2 Then 'cuando es grupo por proveedor, se muestra la cuneta contable TMP_DTDatos = CargaCuentasContables(TMP_DTDatos) GvDatos.Columns(13).Visible = True Else diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index edfc29a1a..f93a39a5f 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -736,8 +736,8 @@ Partial Class ContabilidadC_RegPrePolizaS Private Sub CargaClientes() DdlClientes.setEsWebService(True) DdlClientes.Attributes.Add("data-metodo", "getcliente") - DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - DdlClientes.DataBind() + 'DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + 'DdlClientes.DataBind() ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) End Sub @@ -1359,16 +1359,17 @@ Partial Class ContabilidadC_RegPrePolizaS If CveCliente > 0 Then DvModalconceptoCliente.Visible = True - DdlClientesE.SelectedValue = CveCliente - DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial", "") - DdlClientesE_SelectedIndexChanged(DdlClientesE, e) + DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial", "") + DdlClientesE.ddl.Items.Insert(0, New ListItem(GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial", ""), CveCliente)) + DdlClientesE.SelectedValue = CveCliente + + CargaVentasE(CveCliente) End If If CveVenta > 0 Then DdlVentasE.SelectedValueExist(CveVenta) End If - If CveClasificacion > 0 Then DdlClasificacionesE.SelectedValue = CveClasificacion End If @@ -1621,11 +1622,20 @@ Partial Class ContabilidadC_RegPrePolizaS DdlClientesE.setEsWebService(True) DdlClientesE.Attributes.Add("data-metodo", "getcliente") - 'DdlClientesE.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - 'DdlClientesE.DataBind() - ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub - Private Sub CargaVentasE(CveCliente As Integer, Optional CveMoneda As Integer = -1) + Private Sub CargaVentasE(CveCliente As Integer) + If CveCliente <= 0 Then Exit Sub + + If DrConceptoContable IsNot Nothing Then + Dim AplicaME = Boolean.Parse(DrConceptoContable("EsMonedaExtranjera").ToString) + Dim AplicaVenta = Boolean.Parse(DrConceptoContable("AplicaVenta").ToString) + If AplicaME Then + CveMoneda = 2 + End If + If Not AplicaVenta Then Exit Sub + End If + DvModalconceptoVenta.Visible = True DdlVentasE.DataSource = Nothing DdlVentasE.ClearSelection() @@ -1661,16 +1671,9 @@ Partial Class ContabilidadC_RegPrePolizaS CargaComprasE(DdlProveedoresE.SelectedValue.ToEntero) End Sub Private Sub DdlClientesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientesE.selectedindexchange - Dim tCveMoneda As Integer = 1 - If DrConceptoContable IsNot Nothing Then - Dim AplicaME = Boolean.Parse(DrConceptoContable("EsMonedaExtranjera").ToString) - If AplicaME Then - tCveMoneda = 2 - End If - End If + If DdlClientesE.SelectedValue.ToEntero > 0 Then CargaVentasE(DdlClientesE.SelectedValue.ToEntero) - CargaVentasE(DdlClientesE.SelectedValue.ToEntero, tCveMoneda) End Sub Private Function CargaValidacionesConcepto() As Boolean @@ -1853,7 +1856,7 @@ Partial Class ContabilidadC_RegPrePolizaS TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero UpTotalCargo.Update() UpTotalAbono.Update() - DdlClientesE.SelectedValue = "-1" + DdlClientesE.ddl.Items.Clear() DdlClientesE.SelectedText = "" End If diff --git a/Contabilidad2/CatCuentas.aspx b/Contabilidad2/CatCuentas.aspx index ad6288165..51bcc8812 100644 --- a/Contabilidad2/CatCuentas.aspx +++ b/Contabilidad2/CatCuentas.aspx @@ -47,6 +47,11 @@ font-size: 9px !important; content: "\f040"; } + + #select2-C_DdlCuentaContable-results{ + max-width:300px!important + } + @@ -110,6 +115,9 @@
Subcuenta de
+ +
diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index 39a2a3978..6845bb71a 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -186,6 +186,10 @@ Partial Class Contabilidad2_CatCuentas End Function Protected Sub agregar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.addclick LimpiarCampos() + + Tsubcuenta.Visible = True + DdlCuentaContable.Visible = False + Dim dt As New DataTable 'IDSelected = HdnID.Value.ToEntero() "ul" + itempadre.Cve; @@ -243,6 +247,11 @@ Partial Class Contabilidad2_CatCuentas Protected Sub editar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.editclick LimpiarCampos() limpiavalorescontables() + CargaCuentasContables() + + Tsubcuenta.Visible = False + DdlCuentaContable.Visible = True + Dim dt As DataTable Dim obj As ADServerControl.DragableItem = DirectCast(sender, ADServerControl.DragableItem) IDSelected = obj.Cve @@ -301,6 +310,7 @@ Partial Class Contabilidad2_CatCuentas If dt.Rows.Count > 0 Then Dim drt As DataRow = dt.Rows(0) Tsubcuenta.Text = drt("Codigo").ToString + DdlCuentaContable.SelectedValueExist(drt("CveCuenta").ToString) LblSubCuenta.Text = drt("Nombre").ToString End If @@ -313,6 +323,25 @@ Partial Class Contabilidad2_CatCuentas End Sub + Private Sub CargaCuentasContables() + + DdlCuentaContable.ClearSelection() + DdlCuentaContable.Items.Clear() + DdlCuentaContable.SelectedValue = Nothing + + Dim ObjConta As New ClsContabilidad + + If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + DdlCuentaContable.DataSource = ObjConta.DtResultados + End If + + ObjConta.Dispose() + + DdlCuentaContable.DataBind() + DdlCuentaContable.Items.Insert(0, New ListItem("-", "-1")) + DdlCuentaContable.SelectedValueExist("-1") + + End Sub Protected Sub Guardar_Click(sender As Object, e As EventArgs) Handles Guardar.Click If Tnombre.Text.Trim = "" Then Alert("Ingrese nombre de la cuenta", TipoMensaje.MsgError) : Exit Sub @@ -328,11 +357,13 @@ Partial Class Contabilidad2_CatCuentas Dim CveBancoCuenta As Integer = ddlBancos.SelectedValue.ToEntero Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero() + + If DdlAgrupadorSAT.SelectedValue.ToEntero > 0 Then If ObjConta.UpdateCuenta(IDSelected.ToEntero, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToString.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString, CveConceptoAdmin:=CveConceptoAdmin, CveProveedor:=CveProveedor, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeImpuesto, - CveBancoCuenta:=CveBancoCuenta, CveAlmacen:=CveAlmacen, Codigo:=TxtCuenta.Text.Replace("-", "")) Then + CveBancoCuenta:=CveBancoCuenta, CveAlmacen:=CveAlmacen, Codigo:=TxtCuenta.Text.Replace("-", ""), CvePadre:=DdlCuentaContable.SelectedValue.ToEntero) Then If UsuarioActual.Empresa.TipoContabilidad = 2 Then Dim ObjContaEmpresa As New ClsContPAQi(UsuarioActual.Empresa) @@ -592,6 +623,9 @@ Partial Class Contabilidad2_CatCuentas nuevacuenta.Visible = False TxtCuenta.Enabled = False 'Tcuenta.Enabled = False + DdlCuentaContable.SelectedValueExist(-1) + DdlCuentaContable.Visible = False + Tsubcuenta.Visible = True BtnEliminar.Visible = False End Sub diff --git a/Contabilidad2/RepSituacionFinanciera.aspx b/Contabilidad2/RepSituacionFinanciera.aspx index 658c61e07..655bd61dc 100644 --- a/Contabilidad2/RepSituacionFinanciera.aspx +++ b/Contabilidad2/RepSituacionFinanciera.aspx @@ -58,7 +58,7 @@ -
+
diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 011cfec39..652cdc548 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -576,33 +576,36 @@ Partial Class General_SaldosIniciales Alert("El nombre de la primera columna debe ser 'CuentaBancaria'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - - If Not dt.Columns(1).ColumnName = "Importe" Then + If Not dt.Columns(1).ColumnName = "Banco" Then + Alert("El nombre de la primera columna debe ser 'Banco'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(2).ColumnName = "Importe" Then Alert("El nombre de la segunda columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(2).ColumnName = "Moneda" Then + If Not dt.Columns(3).ColumnName = "Moneda" Then Alert("El nombre de la segunda columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(3).ColumnName = "TipoCambio" Then + If Not dt.Columns(4).ColumnName = "TipoCambio" Then Alert("El nombre de la segunda columna debe ser 'TipoCambio'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(4).ColumnName = "Fecha" Then + If Not dt.Columns(5).ColumnName = "Fecha" Then Alert("El nombre de la cuarta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(5).ColumnName = "Descripcion" Then + If Not dt.Columns(6).ColumnName = "Descripcion" Then Alert("El nombre de la cuarta columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(6).ColumnName = "CuentaContable" Then + If Not dt.Columns(7).ColumnName = "CuentaContable" Then Alert("El nombre de la tercera columna debe ser 'CuentaContable'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If @@ -1018,7 +1021,7 @@ Partial Class General_SaldosIniciales Dim CodigoRegimenFiscal As String = Row("Regimen Fiscal").ToString - Dim Clasificacion As String = Row("Clasificación Proveedor").ToString + Dim ProveedorClasificacion As String = Row("Clasificación Proveedor").ToString Dim Moneda As String = Row("Moneda Preferente").ToString Dim DIOTTipoTercero As String = Row("Tipo Tercero").ToString.Trim.ToUpper Dim DIOTipoOperacion As String = Row("Tipo Operación").ToString @@ -1100,10 +1103,10 @@ Partial Class General_SaldosIniciales End If - If Clasificacion.Trim.Length > 0 Then - CveProveedorClasificacion = DTClasificaciones.FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero + If ProveedorClasificacion.Trim.Length > 0 Then + CveProveedorClasificacion = GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedorClasificacion", $"ProveedorClasificacion = '{ProveedorClasificacion}'").ToString.ToEntero If Not CveProveedorClasificacion > 0 Then - sbErrores.AppendLine($"Proveedor {RazonSocial} Clasificación {Clasificacion} invalida.
") + sbErrores.AppendLine($"Proveedor {RazonSocial} Proveedor Clasificacion {ProveedorClasificacion} invalida.
") ErrorProv = True End If End If @@ -2019,10 +2022,10 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim Cuenta As String = Row("Cuenta").ToString.Trim + Dim Cuenta As String = Row("Cuenta").ToString.Trim.Replace("-", "") If Cuenta <> "" Then NombreCuenta = Row("NombreCuenta").ToString.Trim - CuentaPadre = Row("CuentaPadre").ToString.Trim + CuentaPadre = Row("CuentaPadre").ToString.Trim.Replace("-", "") Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim @@ -2494,11 +2497,11 @@ Partial Class General_SaldosIniciales Dim Contador As Integer = 0 For Each dRow As DataRow In DTBancos.Rows - Dim Fecha As Date = dRow("Fecha").ToString.ToDate Dim Importe As Decimal = dRow("Importe").ToString.ToDecimal Dim Descripcion As String = dRow("Descripcion").ToString - Dim NumCuenta As String = dRow("CuentaBancaria").ToString + Dim Banco As String = dRow("Banco").ToString + Dim NumCuenta As String = dRow("CuentaBancaria").ToString.Trim Dim ImporteMX As Decimal = 0 Dim ImporteME As Decimal = 0 @@ -2506,8 +2509,6 @@ Partial Class General_SaldosIniciales Dim CveMoneda As Integer Dim TipoCambio As Decimal = dRow("TipoCambio").ToString.ToDecimal - - If Moneda.ToUpper.Contiene("PESOS", "PESO", "MXN") Then CveMoneda = 1 TipoCambio = 1 @@ -2536,16 +2537,32 @@ Partial Class General_SaldosIniciales End If - - Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1).FiltroPrimeroValor("CveCuenta", $" NumCuenta = '{NumCuenta}'").ToEntero + Dim CveTipoTransaccion As Integer = 3 ' tipo transaccion, cheque recibido + Dim CveCuentaBancaria As Integer = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=-1).FiltroPrimeroValor("CveCuenta", $" NumCuenta = '{NumCuenta}'").ToEntero If Not CveCuentaBancaria > 0 Then - Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia) - ErrorProceso = True - Exit For + + ' se registrará primero + Dim CveBanco As Integer = GlobalDTBancos().FiltroPrimeroValor("CveBanco", String.Format("CveEmpresa = {0} AND Banco = '{1}'", UsuarioActual.CveEmpresa, Banco)).ToEntero + + If CveBanco > 0 Then + Dim CveTipoCuenta As Integer = 2 'tipo de cheques + If NumCuenta.ToLower.Contains("caja chica") Then CveTipoCuenta = 1 ' cuando es caja chica + If ObjBancos.AddBancosCuentas(CveBanco, 2, NumCuenta, "", CveMoneda, 1, 1, 1, 9999999, 0, 0, 0, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", False, False) Then + CveCuentaBancaria = ObjBancos.TCveCuenta + Else + Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia) + ErrorProceso = True : Exit For + End If + Else + Alert($"No se detecto cuenta Bancaria {NumCuenta}", TipoMensaje.MsgAdvertencia) + ErrorProceso = True : Exit For + End If End If + If ImporteMX < 0 Then CveTipoTransaccion = 2 'salida de dinero, concepto de transferencia realizada + Dim FolioStr As String = "" - FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, 3) + Contador) + FolioStr = CStr(ObjBancos.GetNextFolio(CveCuentaBancaria, CveTipoTransaccion)) Dim CveCuentaContable As Integer = 0 Dim CuentaContable As String = dRow("CuentaContable").ToString.Trim.Replace("-", "").Replace(" ", "") @@ -2568,32 +2585,30 @@ Partial Class General_SaldosIniciales End If - - If Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then + If CveCuentaContable > 0 AndAlso Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then ErrorProceso = True Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia) Exit For End If - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Bancos/SaldoInicial", 66, Importe, Importe, CveMoneda, Fecha, FolioStr, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If Importe <> 0 Then + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Bancos/SaldoInicial", 66, Importe, Importe, CveMoneda, Fecha, FolioStr, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not CvePrePoliza > 0 Then + ErrorProceso = True : Exit For + End If + + Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, CveTipoTransaccion, Fecha, FolioStr.ToString, "", Importe, CveMoneda, + TipoCambio, Descripcion, "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString, 95, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - If Not CvePrePoliza > 0 Then - ErrorProceso = True - Exit For End If - - Dim CveIE As Integer = ObjBancos.AddBancos_IE(CveCuentaBancaria, 3, Fecha, FolioStr.ToString, "", Importe, CveMoneda, - TipoCambio, Descripcion, "", False, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, FolioStr.ToString, 30, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, FolioStr.ToString, 95, FolioStr, Fecha, -1, -1, CveIE:=CveIE, Contabilizable:=False, ImporteMX:=ImporteMX, ImporteME:=ImporteME, TipoCambio:=TipoCambio) Then ErrorProceso = True : Exit For - Contador = Contador + 1 Next - - If Not ErrorProceso Then Alert($"Se agregaron {Contador} Movimientos.") ObjBancos.Commit() diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index b1be09e13..5be5719cd 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -842,8 +842,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim DtPendientes As New DataTable If ObjInventarios.ComprasPendientesAlmacenGet(-1, TxtFechaPendientes.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - Dim FiltroTemporal = If(UsuarioActual.CveEmpresa.Contiene(119, 140, 1, 72, 80, 153, 154), "AND TipoDocto IN ('Fac','NC','DEV')", "AND TipoDocto IN ('Fac')") - DtPendientes = ObjInventarios.DtResultados.FiltraParametros($"CantOC >= 0 {FiltroTemporal}") + DtPendientes = ObjInventarios.DtResultados.FiltraParametros($"CantOC >= 0 AND TipoDocto IN ('Fac','NC','DEV') ") Else DtPendientes = Nothing Alert("Ocurrió un error al obtener las Compras pendientes de recibir del proveedor. Por favor vuelva a intentar", TipoMensaje.MsgError) diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index db37674b1..53a8876e8 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -1,12 +1,7 @@ <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="ProductosServicios.aspx.vb" Inherits="ProductosyServicios" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - + @@ -1906,10 +1901,7 @@

- El producto seleccionado en el recuadro de arriba sera unificado en el producto actual - - - + El producto seleccionado en el recuadro de arriba sera unificado en el producto actual

diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 7d0a7221e..d6b631b89 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1993,7 +1993,7 @@ Partial Class ProductosyServicios RegistraScript("$('#DivUnificar').modal();LimpiaModalUnificar()") End Sub Public Sub CargaPSUnificar() - DdlPsUnificar.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlPsUnificar.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, Estatus:=-1) DdlPsUnificar.DataBind() 'DdlPsUnificar.setEsWebService(True) 'DdlPsUnificar.ddlWS.Attributes.Add("data-clear", "1")