-- mejora en crearapartir de
This commit is contained in:
@@ -946,8 +946,8 @@
|
||||
<button id="BtnCancelar" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:CheckBox ID="ChkSeguir" runat="server" Checked="true" />
|
||||
<label for="<%= ChkSeguir.ClientID.ToString()%>">Seguir Registrando:</label>
|
||||
<asp:CheckBox ID="ChkSeguir" runat="server" Checked="true" Text="Seguir Registrando" TextAlign="Right" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -272,6 +272,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
Actualizar = False
|
||||
IdPoliza = -1
|
||||
|
||||
CargaPlantillas(TipoPlantilla)
|
||||
CargaConceptosContablesE()
|
||||
CargaModalConceptoCuentas()
|
||||
|
||||
@@ -321,7 +322,11 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
CvePrePolizaOrigen = Request("CvePrePolizaOrigen").ToEntero
|
||||
CreaDT()
|
||||
CargaPrePolizaOrigen()
|
||||
If CargaPrePoliza(Request("CvePrePolizaOrigen").ToEntero) Then
|
||||
|
||||
End If
|
||||
ViewState("CvePrePoliza") = "-1"
|
||||
'CargaPrePolizaOrigen()
|
||||
|
||||
OcultarControlesCrearApartirDe()
|
||||
DvPlantilla.Visible = False
|
||||
@@ -347,7 +352,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
LblEncabezado.Text = "Otros Ingresos"
|
||||
End If
|
||||
|
||||
CargaPlantillas(TipoPlantilla)
|
||||
|
||||
|
||||
'If UsuarioActual.CveRol = 1 Then trNotificar.Visible = True
|
||||
|
||||
@@ -454,11 +459,10 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
TxtFechaelaboracion.Text = dr("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy")
|
||||
TxtFechaelaboracion.ToolTip = dr("FechaIng").ToString.ToDate.ToShortTimeString
|
||||
CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString.ToEntero
|
||||
DdlPlantilla.SelectedValue = CvePlantillaPoliza.ToString
|
||||
HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")}"
|
||||
HplImprimirPDF.Visible = True
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
TxtUsuarioElaboro.ToolTip = dr("Modulo").ToString
|
||||
End If
|
||||
If UsuarioActual.CveRol = 1 Then TxtUsuarioElaboro.ToolTip = dr("Modulo").ToString
|
||||
|
||||
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then
|
||||
LnkAddConcepto.Visible = True
|
||||
@@ -479,7 +483,6 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
BtnEliminar.ToolTip = "No se puede eliminar al prepóliza, eliminarla desde el módulo de Bancos"
|
||||
End If
|
||||
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
If Not DtMovimientos.Columns.Contains("IdMov") Then
|
||||
Dim workColumn As DataColumn = DtMovimientos.Columns.Add("IdMov", GetType(Integer))
|
||||
workColumn.AutoIncrement = True
|
||||
@@ -487,14 +490,12 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
End If
|
||||
|
||||
If Not DtMovimientos.Columns.Contains("ContadoCuenta") Then
|
||||
|
||||
DtMovimientos.Columns.Add("ContadoCuenta", GetType(Integer))
|
||||
DtMovimientos.Columns.Add("ContadoTipoTransaccion", GetType(Integer))
|
||||
DtMovimientos.Columns.Add("ContadoNumeroFolio", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoBeneficiario", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoObservaciones", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoImporte", GetType(Decimal))
|
||||
|
||||
End If
|
||||
|
||||
If Not DtMovimientos.Columns.Contains("Cargo") Then
|
||||
@@ -502,6 +503,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
DtMovimientos.Columns.Add("Abono", GetType(Decimal))
|
||||
End If
|
||||
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
GvPrePoliza.DataBind()
|
||||
|
||||
If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then
|
||||
@@ -734,7 +736,6 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
DdlPersonal.Items.Insert(0, New ListItem(" - ", "-1"))
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub DdlPlantilla_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantilla.SelectedIndexChanged
|
||||
|
||||
TxtTotalAbonos.Text = ""
|
||||
@@ -781,7 +782,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
Dim dr As DataRow = DtMovimientos.NewRow
|
||||
|
||||
dr("CodigoNombreCuenta") = drt("Codigo").ToString & "<br>" & drt("Nombre").ToString
|
||||
dr("Cuenta") = drt("ConceptoContable").ToString
|
||||
'dr("Cuenta") = drt("ConceptoContable").ToString
|
||||
dr("Referencia") = If(drt("CveConceptoContable").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
|
||||
dr("Concepto") = TxtConcepto.Text
|
||||
dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1)
|
||||
@@ -802,7 +803,6 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
DtMovimientos.Rows.Add(dr)
|
||||
Next
|
||||
|
||||
|
||||
GvMov.DataSource = DtMovimientos
|
||||
GvMov.DataBind()
|
||||
GvPrePoliza.DataBind() ''limpio el grid
|
||||
@@ -893,15 +893,15 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click
|
||||
|
||||
Dim FolioPoliza As Integer = -1
|
||||
Dim CvePrePolizaInsertada As Integer = -1
|
||||
|
||||
If CvePrePolizaOrigen > 0 Then
|
||||
CrearPrePolizaApartirDe()
|
||||
Exit Sub
|
||||
End If
|
||||
'If CvePrePolizaOrigen > 0 Then
|
||||
' 'CrearPrePolizaApartirDe()
|
||||
' 'Exit Sub
|
||||
'End If
|
||||
|
||||
Dim TotalCargos, TotalAbonos As Decimal
|
||||
|
||||
@@ -1105,7 +1105,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
ObjIE.Commit()
|
||||
TxtConcepto.Text = ""
|
||||
DdlPlantilla_SelectedIndexChanged(Nothing, Nothing)
|
||||
If DdlPlantilla.Visible Then DdlPlantilla_SelectedIndexChanged(Nothing, Nothing)
|
||||
TxtFechaDocumento.Text = ""
|
||||
Else
|
||||
Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError)
|
||||
@@ -1265,6 +1265,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
BtnAceptar.Text = "Aceptar"
|
||||
LimpiaCampos()
|
||||
IndiceGrid = e.RowIndex
|
||||
If IndiceGrid > 0 Then ChkSeguir.Visible = False
|
||||
|
||||
Dim CveConceptoContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveConceptoContable").ToEntero
|
||||
Dim CveProveedor As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveProveedor").ToEntero
|
||||
@@ -1666,143 +1667,92 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
Exit Sub
|
||||
End If
|
||||
ChkSeguir.Visible = False
|
||||
Dim dr As DataRow = Nothing
|
||||
|
||||
If IndiceGrid = -1 Then
|
||||
If IndiceGrid = -1 Then 'si es nuevo, crea el row
|
||||
ChkSeguir.Visible = True
|
||||
If DtMovimientos Is Nothing Then CreaDT()
|
||||
|
||||
Dim dr As DataRow = DtMovimientos.NewRow
|
||||
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
||||
dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
|
||||
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
||||
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
|
||||
dr("Concepto") = TxtConceptoE.Text
|
||||
dr("Referencia") = TxtReferenciaE.Text
|
||||
dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, False, True)
|
||||
dr("Cargo") = TxtCargoE.Text.ToDecimal
|
||||
dr("Abono") = TxtAbonoE.Text.ToDecimal
|
||||
dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal)
|
||||
dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue
|
||||
dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text
|
||||
dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero
|
||||
dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero
|
||||
dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero
|
||||
dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero
|
||||
dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero
|
||||
If DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlComprasE.SelectedItem.ToString()
|
||||
If DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlVentasE.SelectedItem.ToString()
|
||||
dr("Modificado") = True
|
||||
dr("TC") = TxtTipoCambio.Text.ToDecimal
|
||||
|
||||
dr("ContadoCuenta") = DdlModalConceptoCuenta.SelectedValue.ToEntero
|
||||
dr("ContadoTipoTransaccion") = DdlModalConceptoTipoTransaccion.SelectedValue.ToEntero
|
||||
dr("ContadoNumeroFolio") = TxtModalConceptoDocumentoFolio.Text
|
||||
dr("ContadoBeneficiario") = TxtModalConceptoDocumentoBeneficiario.Text
|
||||
dr("ContadoObservaciones") = TxtModalConceptoDocumentoObservaciones.Text
|
||||
dr("ContadoImporte") = dr("ImporteMN").ToString
|
||||
|
||||
If DrConceptoContable IsNot Nothing Then
|
||||
dr("EsComplementaria") = DrConceptoContable("EsComplementaria")
|
||||
dr("EsMonedaExtranjera") = DrConceptoContable("EsMonedaExtranjera")
|
||||
|
||||
If dr("EsMonedaExtranjera").ToString = "True" Then dr("ImporteME") = TxtME.Text.ToDecimal
|
||||
End If
|
||||
|
||||
If DdlPorcentajeIVAE.Visible Then
|
||||
dr("PorcentajeImpuesto") = DdlPorcentajeIVAE.SelectedValue.ToDecimal
|
||||
End If
|
||||
|
||||
DtMovimientos.Rows.Add(dr)
|
||||
DtMovimientos.AcceptChanges()
|
||||
|
||||
'If CvePrePoliza > 0 Or CvePrePolizaOrigen > 0 Then
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
GvPrePoliza.DataBind()
|
||||
UpPrePoliza.Visible = True
|
||||
'End If
|
||||
|
||||
TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero
|
||||
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
|
||||
UpTotalCargo.Update()
|
||||
UpTotalAbono.Update()
|
||||
If Not ChkSeguir.Checked Then RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
|
||||
Alert("Concepto Registrado", TipoMensaje.ToastInformacion)
|
||||
Else
|
||||
dr = DtMovimientos.NewRow
|
||||
Else 'si ya existe, asigna el row
|
||||
ChkSeguir.Visible = False
|
||||
Dim CvePrePolizaDetalle As Integer = GvPrePoliza.DataKeys(IndiceGrid).Value.ToString.ToEntero
|
||||
|
||||
Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle)
|
||||
If CvePrePolizaDetalle <= 0 Then
|
||||
Dim IdMov As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("IdMov").ToEntero
|
||||
Rows = DtMovimientos.Select("IdMov = " & IdMov)
|
||||
End If
|
||||
If Rows.Count > 0 Then
|
||||
Dim dr As DataRow = Rows(0)
|
||||
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
||||
dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
|
||||
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
||||
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
|
||||
dr("Concepto") = TxtConceptoE.Text
|
||||
dr("Referencia") = TxtReferenciaE.Text
|
||||
dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, False, True)
|
||||
dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal)
|
||||
dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue
|
||||
dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text
|
||||
dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero
|
||||
dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero
|
||||
dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero
|
||||
dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero
|
||||
dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero
|
||||
dr("FolioFactura") = If(DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedItem IsNot Nothing, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedItem IsNot Nothing, DdlVentasE.SelectedItem.ToString, ""))
|
||||
dr("Modificado") = True
|
||||
|
||||
dr("ContadoCuenta") = DdlModalConceptoCuenta.SelectedValue.ToEntero
|
||||
dr("ContadoTipoTransaccion") = DdlModalConceptoTipoTransaccion.SelectedValue.ToEntero
|
||||
dr("ContadoNumeroFolio") = TxtModalConceptoDocumentoFolio.Text
|
||||
dr("ContadoBeneficiario") = TxtModalConceptoDocumentoBeneficiario.Text
|
||||
dr("ContadoObservaciones") = TxtModalConceptoDocumentoObservaciones.Text
|
||||
dr("ContadoImporte") = TxtModalConceptoDocumentoImporte.Text.ToDecimal
|
||||
|
||||
dr("TC") = TxtTipoCambio.Text.ToDecimal
|
||||
|
||||
If DrConceptoContable IsNot Nothing Then
|
||||
dr("EsComplementaria") = DrConceptoContable("EsComplementaria")
|
||||
dr("EsMonedaExtranjera") = DrConceptoContable("EsMonedaExtranjera")
|
||||
|
||||
If dr("EsMonedaExtranjera").ToString = "True" Then dr("ImporteME") = TxtME.Text.ToDecimal
|
||||
|
||||
End If
|
||||
|
||||
dr("PorcentajeImpuesto") = DdlPorcentajeIVAE.SelectedValue.ToDecimal
|
||||
|
||||
If TxtCargoE.Text <> "" Then
|
||||
dr("Cargo") = TxtCargoE.Text.ToDecimal
|
||||
dr("Abono") = 0
|
||||
Else
|
||||
dr("Abono") = TxtAbonoE.Text.ToDecimal
|
||||
dr("Cargo") = 0
|
||||
End If
|
||||
|
||||
DtMovimientos.AcceptChanges()
|
||||
GvPrePoliza.EditIndex = -1
|
||||
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
GvPrePoliza.DataBind()
|
||||
UpPrePoliza.Update()
|
||||
GvPrePoliza.Visible = True
|
||||
GvPrePoliza.Rows(IndiceGrid).FCCheckBox("chkModificado").Checked = True
|
||||
|
||||
TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero
|
||||
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
|
||||
UpTotalCargo.Update()
|
||||
UpTotalAbono.Update()
|
||||
DdlClientesE.ddl.Items.Clear()
|
||||
DdlClientesE.SelectedText = ""
|
||||
|
||||
dr = Rows(0)
|
||||
End If
|
||||
RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
|
||||
End If
|
||||
UpPrePoliza.Update()
|
||||
|
||||
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
||||
dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
|
||||
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
||||
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
|
||||
dr("Concepto") = TxtConceptoE.Text
|
||||
dr("Referencia") = TxtReferenciaE.Text
|
||||
dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, False, True)
|
||||
dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDecimal) > 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal)
|
||||
dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue
|
||||
dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text
|
||||
dr("CveClasificacion") = DdlClasificacionesE.SelectedValue.ToEntero
|
||||
dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero
|
||||
dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero
|
||||
dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero
|
||||
dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero
|
||||
dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero
|
||||
dr("FolioFactura") = If(DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedItem IsNot Nothing, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedItem IsNot Nothing, DdlVentasE.SelectedItem.ToString, ""))
|
||||
dr("Modificado") = True
|
||||
dr("TC") = TxtTipoCambio.Text.ToDecimal
|
||||
|
||||
dr("ContadoCuenta") = DdlModalConceptoCuenta.SelectedValue.ToEntero
|
||||
dr("ContadoTipoTransaccion") = DdlModalConceptoTipoTransaccion.SelectedValue.ToEntero
|
||||
dr("ContadoNumeroFolio") = TxtModalConceptoDocumentoFolio.Text
|
||||
dr("ContadoBeneficiario") = TxtModalConceptoDocumentoBeneficiario.Text
|
||||
dr("ContadoObservaciones") = TxtModalConceptoDocumentoObservaciones.Text
|
||||
dr("ContadoImporte") = TxtModalConceptoDocumentoImporte.Text.ToDecimal
|
||||
|
||||
If DdlComprasE.Visible = True AndAlso DdlComprasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlComprasE.SelectedItem.ToString()
|
||||
If DdlVentasE.Visible = True AndAlso DdlVentasE.SelectedValue.ToEntero > 0 Then dr("FolioFactura") = DdlVentasE.SelectedItem.ToString()
|
||||
|
||||
If DrConceptoContable IsNot Nothing Then
|
||||
dr("EsComplementaria") = DrConceptoContable("EsComplementaria")
|
||||
dr("EsMonedaExtranjera") = DrConceptoContable("EsMonedaExtranjera")
|
||||
If dr("EsMonedaExtranjera").ToString = "True" Then dr("ImporteME") = TxtME.Text.ToDecimal
|
||||
End If
|
||||
|
||||
If DdlPorcentajeIVAE.Visible Then
|
||||
dr("PorcentajeImpuesto") = DdlPorcentajeIVAE.SelectedValue.ToDecimal
|
||||
End If
|
||||
|
||||
If TxtCargoE.Text <> "" Then
|
||||
dr("Cargo") = TxtCargoE.Text.ToDecimal : dr("Abono") = 0
|
||||
Else
|
||||
dr("Abono") = TxtAbonoE.Text.ToDecimal : dr("Cargo") = 0
|
||||
End If
|
||||
|
||||
If IndiceGrid = -1 Then
|
||||
DtMovimientos.Rows.Add(dr)
|
||||
Alert("Concepto Registrado", TipoMensaje.ToastInformacion)
|
||||
End If
|
||||
|
||||
DtMovimientos.AcceptChanges()
|
||||
GvPrePoliza.EditIndex = -1
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
GvPrePoliza.DataBind()
|
||||
UpPrePoliza.Update()
|
||||
GvPrePoliza.Visible = True
|
||||
If IndiceGrid > 0 Then GvPrePoliza.Rows(IndiceGrid).FCCheckBox("chkModificado").Checked = True
|
||||
|
||||
TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero
|
||||
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
|
||||
UpTotalCargo.Update()
|
||||
UpTotalAbono.Update()
|
||||
DdlClientesE.ddl.Items.Clear()
|
||||
DdlClientesE.SelectedText = ""
|
||||
UpPrePoliza.Update()
|
||||
If Not ChkSeguir.Checked OrElse Not ChkSeguir.Visible Then RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
|
||||
End Sub
|
||||
Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting
|
||||
|
||||
@@ -2113,7 +2063,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
If DrM IsNot Nothing Then
|
||||
HdnCve.Value = idMov.ToString
|
||||
CargaCuentasContables()
|
||||
|
||||
ChkSeguir.Visible = False
|
||||
DdlCuentaContable.SelectedValueExist(DrM("CveCuenta").ToString)
|
||||
TxtReferencia.Text = DrM("Referencia").ToString
|
||||
TxtConcepto.Text = DrM("Concepto").ToString
|
||||
@@ -2610,11 +2560,9 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
UpGuardar.Update()
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
If IdPoliza > 0 Then 'si está bloqueada, lo desbloqueaprimero
|
||||
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||
End If
|
||||
@@ -2625,22 +2573,16 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
Else
|
||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjConta.Dispose()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region "Crear A Partier de"
|
||||
|
||||
|
||||
#Region "Crear A Partir de"
|
||||
Private Sub OcultarControlesCrearApartirDe()
|
||||
|
||||
BtnEliminar.Visible = False
|
||||
@@ -2652,10 +2594,10 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
TxtConcepto.Enabled = True
|
||||
TxtFechaDocumento.Text = NowADS().ToString("dd/MM/yyyy")
|
||||
TxtFechaelaboracion.Text = NowADS().ToString("dd/MM/yyyy")
|
||||
divContabilizada.Visible = False
|
||||
TxtFolio.Text = ""
|
||||
|
||||
TxtUsuarioElaboro.Text = UsuarioActual.Usuario
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -2679,284 +2621,11 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub CargaPrePolizaOrigen()
|
||||
BtnEliminar.Visible = True
|
||||
LblEncabezado.Text = "Crear a partir de"
|
||||
|
||||
Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjContabilidad.GetPrePoliza(CvePrePolizaOrigen, UsuarioActual.CveEmpresa) Then
|
||||
Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("")
|
||||
If dr IsNot Nothing Then
|
||||
DivAgregarConceptos.Visible = False
|
||||
DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza").ToString
|
||||
TxtFechaDocumento.Text = dr("Fecha").ToString.ToDate.ToShortDateString
|
||||
TxtConcepto.Text = dr("Concepto").ToString
|
||||
DivDatosPoliza.Visible = True
|
||||
TipoPoliza = DdlTipoPoliza.SelectedItem.Text
|
||||
Folio = dr("FolioPoliza").ToString
|
||||
|
||||
TxtFolio.Text = ""
|
||||
TxtUsuarioElaboro.Text = dr("Usuario").ToString
|
||||
TxtFechaelaboracion.Text = dr("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy")
|
||||
' TxtEstatus.Text = If(Boolean.Parse(dr("Estatus").ToString), "Activa", "Inactiva")
|
||||
CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString.ToEntero
|
||||
|
||||
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then
|
||||
'DivAgregarConceptos.Visible = True
|
||||
LnkAddConcepto.Visible = True
|
||||
CargaConceptos()
|
||||
CargaSubProyectos()
|
||||
CargaCuentasContables()
|
||||
End If
|
||||
|
||||
ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePolizaOrigen, UsuarioActual.CveEmpresa)
|
||||
DtMovimientos = ObjContabilidad.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
|
||||
|
||||
If Not DtMovimientos.Columns.Contains("IdMov") Then
|
||||
Dim cold As New DataColumn With {.AutoIncrement = True, .AutoIncrementSeed = 1, .AutoIncrementStep = 1, .ColumnName = "IdMov", .DataType = Type.GetType("System.Int32")}
|
||||
DtMovimientos.Columns.Add(cold)
|
||||
End If
|
||||
If Not DtMovimientos.Columns.Contains("ContadoCuenta") Then
|
||||
|
||||
DtMovimientos.Columns.Add("ContadoCuenta", GetType(Integer))
|
||||
DtMovimientos.Columns.Add("ContadoTipoTransaccion", GetType(Integer))
|
||||
DtMovimientos.Columns.Add("ContadoNumeroFolio", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoBeneficiario", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoObservaciones", GetType(String))
|
||||
DtMovimientos.Columns.Add("ContadoImporte", GetType(Decimal))
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If Not DtMovimientos.Columns.Contains("Cargo") Then
|
||||
DtMovimientos.Columns.Add("Cargo", GetType(Decimal))
|
||||
DtMovimientos.Columns.Add("Abono", GetType(Decimal))
|
||||
End If
|
||||
|
||||
GvPrePoliza.DataSource = DtMovimientos
|
||||
GvPrePoliza.DataBind()
|
||||
|
||||
If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then
|
||||
GvPrePoliza.Columns(7).Visible = True
|
||||
End If
|
||||
|
||||
If DtMovimientos.FiltraParametros("CveConceptoContable IN (2,17)").Rows.Count > 0 Then
|
||||
LnkComplementoPago.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
|
||||
If dr("FolioPoliza").ToString.ToEntero > 0 Then
|
||||
divContabilizada.Visible = True
|
||||
Folio = dr("FolioPoliza").ToString
|
||||
|
||||
End If
|
||||
Else
|
||||
If dr("IdPoliza").ToString.ToEntero > 0 Then
|
||||
HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza"))
|
||||
divContabilizada.Visible = True
|
||||
IdPoliza = dr("IdPoliza").ToString.ToEntero
|
||||
ElseIf TxtTotalCargos.Text.ToDecimal = TxtTotalAbonos.Text.ToDecimal Then
|
||||
'sino está contabilizada, se activa el botón
|
||||
'BtnContabilizar.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'divDatosPrincipales.Visible = False
|
||||
'divObservaciones.Visible = False
|
||||
|
||||
UpPrePoliza.Update()
|
||||
|
||||
RegistraScript("comparar();")
|
||||
|
||||
If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then
|
||||
'For Each row As GridViewRow In GvPrePoliza.Rows
|
||||
' row.FCTextBox("TxtCargo").Enabled = False
|
||||
' row.FCTextBox("TxtAbono").Enabled = False
|
||||
'Next
|
||||
End If
|
||||
LnkExcel.Visible = False
|
||||
HplImprimirPDF.Visible = True
|
||||
Else
|
||||
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||
BtnEliminar.Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjContabilidad.Dispose()
|
||||
UpPoliza.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkCrearAPartirDe_Click(sender As Object, e As EventArgs)
|
||||
Response.Redirect($"./RegPrePolizaS.aspx?CvePrePolizaOrigen={CvePrePoliza}")
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CrearPrePolizaApartirDe()
|
||||
Dim CvePrePoliza As Integer
|
||||
Dim FolioPoliza As Integer
|
||||
|
||||
Dim TotalCargos, TotalAbonos As Decimal
|
||||
|
||||
For Each Gvr As GridViewRow In GvPrePoliza.Rows
|
||||
TotalCargos += Gvr.FCLiteral("TxtCargo").Text.ToDecimal
|
||||
TotalAbonos += Gvr.FCLiteral("TxtAbono").Text.ToDecimal
|
||||
Next
|
||||
|
||||
|
||||
'validaciones
|
||||
If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0)) Then
|
||||
Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
'terminan validaciones
|
||||
|
||||
If CvePrePoliza > 0 Then
|
||||
ActualizarPrePoliza()
|
||||
Else
|
||||
Dim MensajeAlert As StringBuilder = New StringBuilder
|
||||
Dim ObjIE As New ClsBancos()
|
||||
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
|
||||
Dim IDPoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
Dim CveIE As Integer
|
||||
Dim FolioIE As String = ""
|
||||
|
||||
Try
|
||||
|
||||
Dim ConceptoPoliza As String = TxtConcepto.Text
|
||||
|
||||
CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePolizaCrear", CvePlantillaPoliza, TotalCargos, TotalAbonos, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPoliza.SelectedValue.ToEntero, AgregarFolio:=True)
|
||||
|
||||
If CvePrePoliza > 0 Then
|
||||
|
||||
FolioPoliza = ObjMov.FolioPoliza
|
||||
|
||||
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
|
||||
Dim idCuentaContabilizacion As Long = 1
|
||||
Dim Importe As Decimal = 0
|
||||
Dim ImporteME As Decimal = 0
|
||||
Dim TipoCambio As Decimal = 1
|
||||
Dim TipoMovto As Boolean = False
|
||||
|
||||
'inserto las compras que voy a pagarDdlSaldos
|
||||
For Each gvr As GridViewRow In GvPrePoliza.Rows
|
||||
|
||||
ImporteME = 0
|
||||
TipoCambio = 1
|
||||
|
||||
If Boolean.Parse(gvr.DataKey("TipoMovto")) Then
|
||||
|
||||
Importe = gvr.FCLiteral("TxtAbono").Text.ToDecimal
|
||||
TipoMovto = True
|
||||
|
||||
If gvr.DataKey("EsComplementaria") = "True" Then
|
||||
ImporteME = gvr.FCLiteral("TxtAbono").Text.ToDecimal 'me
|
||||
TipoCambio = gvr.FCTextBox("TxtModalConceptoDocumentoImporte").Text.ToDecimal
|
||||
End If
|
||||
|
||||
Else
|
||||
Importe = gvr.FCLiteral("TxtCargo").Text.ToDecimal
|
||||
TipoMovto = False
|
||||
|
||||
If gvr.DataKey("EsComplementaria") = "True" Then
|
||||
ImporteME = gvr.FCTextBox("TxtCargo").Text.ToDecimal 'me
|
||||
TipoCambio = gvr.FCTextBox("TxtModalConceptoDocumentoImporte").Text.ToDecimal
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If gvr.DataKey("CveConceptoContable").ToEntero = 30 Then
|
||||
|
||||
Dim tFolio As String = gvr.DataKey("ContadoNumeroFolio").ToString
|
||||
If tFolio.ToEntero = 0 Then tFolio = SiguienteFolioBancos(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero)
|
||||
|
||||
CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFechaDocumento.Text.ToDate, tFolio,
|
||||
gvr.DataKey("ContadoBeneficiario").ToString, Importe, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "",
|
||||
False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
FolioIE = gvr.DataKey("ContadoNumeroFolio").ToString
|
||||
If CveIE < 0 Then
|
||||
MsgError = "No se pudo registrar movimiento bancario"
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If gvr.DataKey("CveConceptoContable").ToEntero <> 30 Then
|
||||
|
||||
If gvr.DataKey("CveConceptoContable").ToEntero = 41 Then
|
||||
CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero
|
||||
Else
|
||||
CveIE = -1
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If Importe <> 0 Then
|
||||
Dim tCveCuenta As Integer = gvr.DataKey("CveCuenta").ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Importe, gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("Referencia"), gvr.DataKey("Concepto"),
|
||||
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveIE:=CveIE,
|
||||
CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero,
|
||||
CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero,
|
||||
ImporteME:=ImporteME, TipoCambio:=TipoCambio, CveTipoGasto:=gvr.DataKey("CveTipoGasto").ToEntero,
|
||||
CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then
|
||||
|
||||
Else
|
||||
MsgError = "No se pudo insertar el detalle de la póliza2"
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
If CveIE > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero = 30 Then
|
||||
MensajeAlert.AppendFormat("<br/>Folio Bancario: <b><a href = ""/Bancos/IE.aspx?CveIE={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CveIE, FolioIE)
|
||||
End If
|
||||
Next
|
||||
|
||||
If MsgError = "" AndAlso ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=1) Then
|
||||
If ObjMov.ValorPolizaDescuadre > 0 Then
|
||||
GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
MsgError = ObjMov.MensajePolizaDescuadre
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
MsgError = "No se pudo insertar la póliza"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgError = "Error"
|
||||
End Try
|
||||
|
||||
'If MsgError = "" Then
|
||||
' If ObjMov.UpdatePrePolizasOrdenamiento(CvePrePoliza, UsuarioActual.CveEmpresa) <= 0 Then
|
||||
' MsgError = "Error al ordenar póliza"
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If MsgError = "" Then
|
||||
Alert(If(MensajeAlert.ToString = "", $"Se registro con exito. {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}", $"Se registro con exito. {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")} <br>" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePoliza}""")
|
||||
|
||||
ObjIE.Commit()
|
||||
TxtConcepto.Text = ""
|
||||
GvMov.DataBind()
|
||||
TxtFechaDocumento.Text = ""
|
||||
|
||||
Else
|
||||
Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError)
|
||||
ObjIE.RollBack()
|
||||
End If
|
||||
|
||||
ObjIE.Dispose()
|
||||
ObjMov.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkGvPrePolizaEliminar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
@@ -3057,7 +2726,5 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user