Commit inicial Ventas Productivo
This commit is contained in:
973
Bancos/PagoAcreedor.aspx.cs
Normal file
973
Bancos/PagoAcreedor.aspx.cs
Normal file
@@ -0,0 +1,973 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using static Extensiones.ModExtensiones;
|
||||
|
||||
public partial class Bancos_PagoAcreedor : ClsPaginas
|
||||
{
|
||||
|
||||
#region "PROPIEDADES"
|
||||
private int IDCtaContableAcreedor
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["IDCtaContableAcreedor"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["IDCtaContableAcreedor"] = value;
|
||||
}
|
||||
}
|
||||
private int IDCtaContableBancos
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["IDCtaContableBancos"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["IDCtaContableBancos"] = value;
|
||||
}
|
||||
}
|
||||
private int IDCtaContableBancosComplementario
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["IDCtaContableBancosComplementario"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["IDCtaContableBancosComplementario"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int IDCtaContableAcreedorExtranjera
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["IDCtaContableAcreedorExtranjera"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["IDCtaContableAcreedorExtranjera"] = value;
|
||||
}
|
||||
}
|
||||
private int IDCtaContableAcreedorComplementaria
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["IDCtaContableAcreedorComplementaria"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["IDCtaContableAcreedorComplementaria"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool UsaComplementaria
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToBoolean(ViewState["UsaComplementaria"]);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["UsaComplementaria"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int CveMonedaCuentaPago
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveMonedaCuentaPago"].ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["CveMonedaCuentaPago"] = value;
|
||||
}
|
||||
}
|
||||
private DataTable DtDatos
|
||||
{
|
||||
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
|
||||
set { ViewState["DtDatos"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
UsaComplementaria = false;
|
||||
CveMonedaCuentaPago = 0;
|
||||
if (UsuarioActual.CveEmpresa.Contiene(1, 119)) { UsaComplementaria = true; }
|
||||
rowComisiones.Visible = UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 126, 119, 122);
|
||||
|
||||
CargaTipoTransaccion();
|
||||
CargaCuentas();
|
||||
CargaProveedores();
|
||||
CargaReporte();
|
||||
CargaSubproyectos();
|
||||
TxtFechaDocumento.Text = DateTime.Now.ToShortDateString();
|
||||
TxtFechaPrestamo.Text = DateTime.Now.ToShortDateString();
|
||||
txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString();
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
TxtImporte.Attributes.Add("disabled", "disabled");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void CargaSubproyectos()
|
||||
{
|
||||
|
||||
DdlSubProyecto.DataSource = get_GlobalDTSubProyectos(-1, CveEmpresa: UsuarioActual.CveEmpresa);
|
||||
DdlSubProyecto.DataBind();
|
||||
|
||||
DdlSubProyecto.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region"INFORMACION GENERAL"
|
||||
protected void CargaTipoTransaccion()
|
||||
{
|
||||
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'");
|
||||
DdlTipoTransanccionPrestamo.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'");
|
||||
|
||||
DdlTipoTransaccion.DataBind();
|
||||
DdlTipoTransanccionPrestamo.DataBind();
|
||||
|
||||
DdlTipoTransaccion.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
||||
DdlTipoTransanccionPrestamo.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
||||
}
|
||||
|
||||
protected void CargaCuentas()
|
||||
{
|
||||
DdlCuenta.DataSource = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("CveTipoCuenta <> 1"); //quito las cajas chicas
|
||||
DdlCuentaPrestamo.DataSource = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("CveTipoCuenta <> 1");
|
||||
|
||||
DdlCuenta.DataBind();
|
||||
DdlCuentaPrestamo.DataBind();
|
||||
|
||||
DdlCuenta.Items.Insert(0, new ListItem("Seleccione Cuenta", "-1"));
|
||||
DdlCuentaPrestamo.Items.Insert(0, new ListItem("Seleccione Cuenta", "-1"));
|
||||
}
|
||||
|
||||
protected void CargaProveedores()
|
||||
{
|
||||
DdlProveedores.setEsWebService(true);
|
||||
DdlProveedorPrestamo.setEsWebService(true);
|
||||
DdlProveedorAuxiliar.setEsWebService(true);
|
||||
|
||||
DdlProveedores.Attributes.Add("data-metodo", "getproveedores");
|
||||
DdlProveedorPrestamo.Attributes.Add("data-metodo", "getproveedores");
|
||||
DdlProveedorAuxiliar.Attributes.Add("data-metodo", "getproveedores");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "PAGO ACREEDORES"
|
||||
protected void DdlCuenta_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
DataRow dr = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuenta.SelectedValue));
|
||||
CveMonedaCuentaPago = 0;
|
||||
if (dr != null)
|
||||
{
|
||||
CveMonedaCuentaPago = dr["CveMoneda"].ToString().ToEntero();
|
||||
|
||||
IDCtaContableBancos = dr["IdCtaContable"].ToString().ToEntero();
|
||||
IDCtaContableBancosComplementario = dr["IdCtaContableComplementaria"].ToString().ToEntero();
|
||||
|
||||
}
|
||||
|
||||
if (CveMonedaCuentaPago != 1)
|
||||
{
|
||||
divTCPago.Visible = true;
|
||||
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
||||
}
|
||||
else if (DtDatos != null)
|
||||
{
|
||||
if (DtDatos.FiltraParametros("CveIE > 0 AND Saldo > 0 AND CveMoneda = 2", "").Rows.Count > 0)
|
||||
{
|
||||
divTCPago.Visible = true;
|
||||
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
divTCPago.Visible = false;
|
||||
TxtTCPago.Text = "1";
|
||||
}
|
||||
|
||||
long Folio;
|
||||
ClsBancos bancos = new ClsBancos();
|
||||
Folio = bancos.GetNextFolio(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero());
|
||||
bancos.Dispose();
|
||||
TxtFolio.Text = Folio.ToString();
|
||||
}
|
||||
|
||||
protected void DdlProveedores_selectedindexchange(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (DdlProveedores.SelectedValue.ToEntero() > 0)
|
||||
{
|
||||
ClsMovimientos ObjMov = new ClsMovimientos();
|
||||
if (ObjMov.GetIngresosAcreedorXSaldar(DdlProveedores.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvMovAcreedor.DataSource = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "");
|
||||
DtDatos = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0", "");
|
||||
if (DtDatos.FiltraParametros("CveIE > 0 AND Saldo > 0 AND CveMoneda = 2", "").Rows.Count > 0)
|
||||
{
|
||||
divTCPago.Visible = true;
|
||||
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
||||
}
|
||||
}
|
||||
ObjMov.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
GvMovAcreedor.DataSource = null;
|
||||
}
|
||||
|
||||
GvMovAcreedor.DataBind();
|
||||
//foreach (GridViewRow Gvr in GvMovAcreedor.Rows)
|
||||
//{
|
||||
// Gvr.FCTextBox("TxtCveMoneda").Visible = false;
|
||||
//}
|
||||
UpMovAcreedor.Update();
|
||||
|
||||
}
|
||||
|
||||
protected void GvMovAcreedor_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{2});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), CveMonedaCuentaPago));
|
||||
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',{3});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", CveMonedaCuentaPago));
|
||||
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',{3});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", CveMonedaCuentaPago));
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnIEGuardar_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsBancos ObjIE = new ClsBancos();
|
||||
ClsContabilidad ObjMov = new ClsContabilidad(ObjIE.IniciaTransacSQL());
|
||||
ClsCompras ObjComp = new ClsCompras(ObjIE.IniciaTransacSQL());
|
||||
|
||||
string MsgError = "";
|
||||
int CveIE = 0;
|
||||
int CveConceptoContableBanco = 30;
|
||||
int CveConceptoContablePago = 42;
|
||||
int CveConceptoContableBancoComplementario = 204;
|
||||
int CveConceptoContablePrestamoComplementario = 202;
|
||||
int CvePlantillaPoliza = 21;
|
||||
int CvePrePoliza = 0;
|
||||
int CveMoneda = get_GlobalDTBancosCuentas(-1).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuenta.SelectedValue.ToEntero()}").ToEntero();
|
||||
int FolioFijo = 0;
|
||||
int IDPoliza = 0;
|
||||
StringBuilder Msg = new StringBuilder();
|
||||
|
||||
|
||||
//OBTIENE COMPROBANTE !!
|
||||
string Comprobante = "";
|
||||
List<Archivo> filesgral = Anexo.getfiles().Archivos;
|
||||
string filemove = "";
|
||||
|
||||
foreach (Archivo fileItem in filesgral)
|
||||
{
|
||||
Comprobante = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
||||
filemove = fileItem.filename;
|
||||
}
|
||||
|
||||
// asigna a propiedades las cuentas del acreedor
|
||||
AsignaCuentaProveedor(DdlProveedores.SelectedValue.ToEntero());
|
||||
|
||||
// DATOS PREPOLIZA
|
||||
if ((DdlTipoTransaccion.SelectedValue == "1"))
|
||||
FolioFijo = TxtFolio.Text.ToEntero();
|
||||
CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE PAGO ACRREDORES", CvePlantillaPoliza, TxtImporte.Text.Trim().ToDouble(), TxtImporte.Text.Trim().ToDouble(), CveMoneda, TxtFechaDocumento.Text.ToDate(), DdlProveedores.SelectedText.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa), CveTipoPoliza: ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa));
|
||||
|
||||
if (CvePrePoliza > 0)
|
||||
{
|
||||
decimal ImporteBanco = TxtImporte.Text.ToDecimal();
|
||||
decimal ImporteMNBanco = ImporteBanco;
|
||||
decimal ImporteComplementaria = 0;
|
||||
decimal TCPago = TxtTCPago.Text.ToDecimal();
|
||||
string Conc = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
||||
string Ref = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
||||
|
||||
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero(), TxtFechaDocumento.Text.Trim().ToDate(), TxtFolio.Text.Trim(), DdlProveedores.SelectedText.ToString(), ImporteBanco.ToString().ToDouble(), CveMoneda,
|
||||
TCPago.ToString().ToDouble(), TxtObservaciones.Text.Trim(), "", ChkAbonoCuenta.Checked, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
||||
|
||||
|
||||
|
||||
if (CveIE > 0)
|
||||
{
|
||||
//GUARDA COMPROBANTE
|
||||
if (!filemove.Equals(""))
|
||||
{
|
||||
filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta));
|
||||
}
|
||||
decimal Importe;
|
||||
decimal ImporteMN;
|
||||
decimal ImporteComision;
|
||||
decimal ImporteComisionMN;
|
||||
bool TipoMovtoComision = false;
|
||||
int IdCtaContableOtrosGastos = 0;
|
||||
|
||||
//GUARDA PREPOLIZAS DETALLE
|
||||
foreach (GridViewRow gvr in GvMovAcreedor.Rows)
|
||||
{
|
||||
Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal();
|
||||
ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal();
|
||||
ImporteMN = Importe;
|
||||
ImporteComisionMN = ImporteComision;
|
||||
ImporteComplementaria = 0;
|
||||
|
||||
|
||||
if (gvr.FCTextBox("TxtComision").Text.ToDecimal() < 0)
|
||||
{
|
||||
TipoMovtoComision = true;
|
||||
ImporteComision = ImporteComision * -1;
|
||||
ImporteComisionMN = ImporteComisionMN * -1;
|
||||
IdCtaContableOtrosGastos = UsuarioActual.Empresa.IdCuentaOtrosIngresos;
|
||||
}
|
||||
else
|
||||
{
|
||||
TipoMovtoComision = false;
|
||||
IdCtaContableOtrosGastos = UsuarioActual.Empresa.Funcionalidad(266).ToEntero();
|
||||
|
||||
}
|
||||
|
||||
Decimal TC = gvr.DataKey("TipoCambio").ToDecimal();
|
||||
if (gvr.DataKey("FechaDocumento").ToDate().Month != TxtFechaDocumento.Text.ToDate().Month || gvr.DataKey("FechaDocumento").ToDate().Year != TxtFechaDocumento.Text.ToDate().Year)
|
||||
{
|
||||
TC = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate().AddMonths(-1).LastDayOfMonth()).ToDecimal();
|
||||
}
|
||||
|
||||
|
||||
if (gvr.FCCheckBox("Chk").Checked)
|
||||
{
|
||||
int tCveMoneda = gvr.DataKey("CveMoneda").ToEntero();
|
||||
if (CveMoneda == 1 && tCveMoneda == 1)
|
||||
{
|
||||
ImporteMN = Importe;
|
||||
ImporteComisionMN = ImporteComision;
|
||||
}
|
||||
else if (CveMoneda == 1 && tCveMoneda == 2)
|
||||
{
|
||||
ImporteComisionMN = ImporteComision;
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
ImporteMN = Importe;
|
||||
ImporteComplementaria = Importe * TC - Importe;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImporteMN = Importe * TC;
|
||||
ImporteComplementaria = 0;
|
||||
}
|
||||
}
|
||||
else if (CveMoneda == 2 && tCveMoneda == 1)
|
||||
{
|
||||
|
||||
ImporteMN = Importe;
|
||||
ImporteComisionMN = ImporteComision;
|
||||
}
|
||||
else if (CveMoneda == 2 && tCveMoneda == 2)
|
||||
{
|
||||
ImporteComisionMN = ImporteComision;
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
ImporteMN = Importe;
|
||||
ImporteComplementaria = Importe * TC - Importe;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImporteMN = Importe * TC;
|
||||
ImporteComplementaria = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ImporteMN = Math.Round(ImporteMN, 2, MidpointRounding.AwayFromZero);
|
||||
ImporteComplementaria = Math.Round(ImporteComplementaria, 2, MidpointRounding.AwayFromZero);
|
||||
ImporteComisionMN = Math.Round(ImporteComisionMN, 2, MidpointRounding.AwayFromZero);
|
||||
ImporteComision = Math.Round(ImporteComision, 2, MidpointRounding.AwayFromZero);
|
||||
|
||||
|
||||
|
||||
if (tCveMoneda != 1)
|
||||
{
|
||||
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContablePago, Conc, DateTime.Now, IDCtaContableAcreedorExtranjera, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto:DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de pago acreedor";
|
||||
break;
|
||||
}
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContablePrestamoComplementario, Conc, DateTime.Now, IDCtaContableAcreedorComplementaria, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de acreedor complementaria";
|
||||
}
|
||||
}
|
||||
|
||||
if (TCPago != TC)
|
||||
{
|
||||
int CveConceptoDiferenciaCambiaria = 0;
|
||||
bool TipoMovto = false;
|
||||
int IdCtaContableDiferenciaCambiaria = 0;
|
||||
if (TCPago > TC)
|
||||
{
|
||||
CveConceptoDiferenciaCambiaria = 65;
|
||||
IdCtaContableDiferenciaCambiaria = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria;
|
||||
TipoMovto = false;
|
||||
Importe = (Importe * TCPago) - (Importe * TC);
|
||||
}
|
||||
else if (TCPago < TC)
|
||||
{
|
||||
CveConceptoDiferenciaCambiaria = 64;
|
||||
IdCtaContableDiferenciaCambiaria = UsuarioActual.Empresa.IdCuentaGananciaCambiaria;
|
||||
TipoMovto = true;
|
||||
Importe = (Importe * TC) - (Importe * TCPago);
|
||||
}
|
||||
ImporteMN = Importe;
|
||||
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Ref, CveConceptoDiferenciaCambiaria, Conc, DateTime.Now, IdCtaContableDiferenciaCambiaria, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de diferencia cambiaria";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContablePago, Conc, DateTime.Now, IDCtaContableAcreedor, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de pago acreedor";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImporteComisionMN > 0)
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoComision, ImporteComision, Ref, 255, Conc, DateTime.Now, IdCtaContableOtrosGastos, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComisionMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de pago acreedor";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CveMoneda != 1)
|
||||
{
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
ImporteMNBanco = ImporteBanco;
|
||||
ImporteComplementaria = ImporteBanco * TCPago - ImporteBanco;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImporteMNBanco = ImporteBanco * TCPago;
|
||||
ImporteComplementaria = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, ImporteBanco, Ref, CveConceptoContableBanco, Conc, DateTime.Now, IDCtaContableBancos, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteMNBanco, ImporteME: ImporteBanco, TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de bancos";
|
||||
}
|
||||
|
||||
if (CveMoneda != 1 && UsaComplementaria)
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, ImporteBanco, Ref, CveConceptoContableBancoComplementario, Conc, DateTime.Now, IDCtaContableBancosComplementario, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: ImporteBanco, TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de bancos complementaria";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgError = "No se insertó movimiento bancario";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgError = "No se pudo insertar la póliza";
|
||||
}
|
||||
|
||||
//VALIDA QUE CUADRE LA PREPOLIZA
|
||||
if (ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5))
|
||||
{
|
||||
if (ObjMov.ValorPolizaDescuadre > 0)
|
||||
{
|
||||
MsgError = ObjMov.MensajePolizaDescuadre;
|
||||
ModExtensiones.GuardaLogAD($"Bancos/IE PAGO ACREEDOR | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas");
|
||||
}
|
||||
}
|
||||
|
||||
//CONTABILIZA
|
||||
if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad)
|
||||
{
|
||||
if (IDCtaContableAcreedor > 0 && IDCtaContableBancos > 0)
|
||||
{
|
||||
if (ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa))
|
||||
{
|
||||
IDPoliza = ObjMov.ContaIdPoliza;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IDCtaContableAcreedor < 1)
|
||||
{
|
||||
Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
if (IDCtaContableBancos < 1)
|
||||
{
|
||||
Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MsgError.Equals(""))
|
||||
{
|
||||
if (Msg.ToString().Equals(""))
|
||||
{
|
||||
Msg.Append("El Documento se guardo correctamente");
|
||||
}
|
||||
System.IO.FileInfo archivo = null;
|
||||
|
||||
if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(2, 8, 9))
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta));
|
||||
}
|
||||
else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(1))
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero()));
|
||||
|
||||
if (!archivo.Exists)
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory));
|
||||
}
|
||||
}
|
||||
else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72)
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero()));
|
||||
}
|
||||
|
||||
//if (archivo.Length > 0)
|
||||
//{
|
||||
// if (archivo.Exists)
|
||||
// {
|
||||
// Msg.AppendFormat(@"<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">{1}</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem));
|
||||
// }
|
||||
//}
|
||||
|
||||
if (IDPoliza > 0)
|
||||
{
|
||||
Msg.AppendFormat(@"<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza);
|
||||
}
|
||||
ObjIE.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjIE.RollBack();
|
||||
Alert(MsgError, TipoMensaje.MsgError);
|
||||
}
|
||||
|
||||
if (!Msg.ToString().Equals(""))
|
||||
{
|
||||
string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery);
|
||||
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery));
|
||||
}
|
||||
|
||||
ObjIE.Dispose();
|
||||
ObjMov.Dispose();
|
||||
|
||||
if (ObjComp != null)
|
||||
ObjComp.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "PRESTAMO ACREEDORES"
|
||||
protected void DdlCuentaPrestamo_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
DataRow dr = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuentaPrestamo.SelectedValue));
|
||||
int tCveMoneda = 0;
|
||||
if (dr != null)
|
||||
{
|
||||
tCveMoneda = dr["CveMoneda"].ToString().ToEntero();
|
||||
|
||||
IDCtaContableBancos = dr["IdCtaContable"].ToString().ToEntero();
|
||||
IDCtaContableBancosComplementario = dr["IdCtaContableComplementaria"].ToString().ToEntero();
|
||||
|
||||
}
|
||||
|
||||
if (tCveMoneda != 1)
|
||||
{
|
||||
divTCPrestamo.Visible = true;
|
||||
TxtTCPrestamo.Text = get_GlobalTipoCambio(TxtFechaPrestamo.Text.ToDate()).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
divTCPrestamo.Visible = false;
|
||||
TxtTCPrestamo.Text = "1";
|
||||
}
|
||||
|
||||
|
||||
long Folio;
|
||||
ClsBancos bancos = new ClsBancos();
|
||||
Folio = bancos.GetNextFolio(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero());
|
||||
bancos.Dispose();
|
||||
TxtFolioPrestamo.Text = Folio.ToString();
|
||||
// si la moneda no es peso, se pone tc
|
||||
|
||||
}
|
||||
|
||||
protected void DdlProveedorPrestamo_selectedindexchange(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void AsignaCuentaProveedor(int CveProveedor)
|
||||
{
|
||||
IDCtaContableAcreedor = 0;
|
||||
IDCtaContableAcreedorExtranjera = 0;
|
||||
IDCtaContableAcreedorComplementaria = 0;
|
||||
ClsCompProveedores proveedores = new ClsCompProveedores();
|
||||
|
||||
if (CveProveedor > 0)
|
||||
{
|
||||
if (proveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
IDCtaContableAcreedor = proveedores.IdCtaContAcreedor;
|
||||
IDCtaContableAcreedorExtranjera = proveedores.IdCtaContAcreedorExtranjera;
|
||||
IDCtaContableAcreedorComplementaria = proveedores.IdCtaContAcreedorComplementaria;
|
||||
}
|
||||
}
|
||||
proveedores.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnGuardarPrestamo_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsBancos ObjIE = new ClsBancos();
|
||||
ClsContabilidad ObjMov = new ClsContabilidad(ObjIE.IniciaTransacSQL());
|
||||
ClsCompras ObjComp = new ClsCompras(ObjIE.IniciaTransacSQL());
|
||||
|
||||
string MsgError = "";
|
||||
int CveIE = 0;
|
||||
int CveConceptoContableBanco = 30;
|
||||
int CveConceptoContablePrestamo = 41;
|
||||
int CveConceptoContableBancoComplementario = 204;
|
||||
int CveConceptoContablePrestamoComplementario = 202;
|
||||
int CvePlantillaPoliza = 45;
|
||||
int CvePrePoliza = 0;
|
||||
int CveMoneda = get_GlobalDTBancosCuentas(-1).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuentaPrestamo.SelectedValue.ToEntero()}").ToEntero();
|
||||
int FolioFijo = 0;
|
||||
int IDPoliza = 0;
|
||||
StringBuilder Msg = new StringBuilder();
|
||||
|
||||
//OBTIENE COMPROBANTE !!
|
||||
string Comprobante = "";
|
||||
List<Archivo> filesgral = AnexoPrestamo.getfiles().Archivos;
|
||||
string filemove = "";
|
||||
|
||||
foreach (Archivo fileItem in filesgral)
|
||||
{
|
||||
Comprobante = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
||||
filemove = fileItem.filename;
|
||||
}
|
||||
// asigna a propiedades las cuentas del acreedor
|
||||
AsignaCuentaProveedor(DdlProveedorPrestamo.SelectedValue.ToEntero());
|
||||
|
||||
// DATOS PREPOLIZA
|
||||
if ((DdlTipoTransanccionPrestamo.SelectedValue == "1"))
|
||||
FolioFijo = TxtFolioPrestamo.Text.ToEntero();
|
||||
CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE PRESTAMO ACRREDORES", CvePlantillaPoliza, TxtImportePrestamo.Text.Trim().ToDouble(), TxtImportePrestamo.Text.Trim().ToDouble(), CveMoneda, TxtFechaPrestamo.Text.ToDate(), DdlProveedorPrestamo.SelectedText.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa), CveTipoPoliza: ObjMov.ObtenerTipoPoliza(DdlTipoTransanccionPrestamo.SelectedValue, "-1", UsuarioActual.CveEmpresa));
|
||||
|
||||
if (CvePrePoliza > 0)
|
||||
{
|
||||
decimal Importe = TxtImportePrestamo.Text.ToDecimal();
|
||||
decimal ImporteMN = Importe;
|
||||
decimal ImporteComplementaria = 0;
|
||||
decimal TC = TxtTCPrestamo.Text.ToDecimal();
|
||||
string Conc = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
||||
string Ref = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
||||
|
||||
CveIE = ObjIE.AddBancos_IE(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero(), TxtFechaPrestamo.Text.Trim().ToDate(), TxtFolioPrestamo.Text.Trim(), DdlProveedorPrestamo.SelectedText.ToString(), Importe.ToString().ToDouble(), CveMoneda,
|
||||
TC.ToString().ToDouble(), TxtObservacionesPrestamo.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
||||
|
||||
if (CveMoneda != 1)
|
||||
{
|
||||
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
ImporteMN = Importe;
|
||||
ImporteComplementaria = Importe * TC - Importe;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImporteMN = Importe * TC;
|
||||
ImporteComplementaria = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (CveIE > 0)
|
||||
{
|
||||
//GUARDA COMPROBANTE
|
||||
if (!filemove.Equals(""))
|
||||
{
|
||||
filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta));
|
||||
}
|
||||
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContableBanco, Conc, DateTime.Now, IDCtaContableBancos, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de bancos";
|
||||
}
|
||||
|
||||
|
||||
if (CveMoneda != 1)
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePrestamo, Conc, DateTime.Now, IDCtaContableAcreedorExtranjera, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de acreedor";
|
||||
}
|
||||
if (UsaComplementaria)
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContableBancoComplementario, Conc, DateTime.Now, IDCtaContableBancosComplementario, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de bancos complementaria";
|
||||
}
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePrestamoComplementario, Conc, DateTime.Now, IDCtaContableAcreedorComplementaria, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de acreedor complementaria";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePrestamo, Conc, DateTime.Now, IDCtaContableAcreedor, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
||||
{
|
||||
MsgError = "No se pudo insertar concepto de acreedor";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgError = "No se insertó el encabezado";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgError = "No se pudo insertar la póliza";
|
||||
}
|
||||
|
||||
//VALIDA QUE CUADRE LA POLIZA
|
||||
if (ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5))
|
||||
{
|
||||
if (ObjMov.ValorPolizaDescuadre > 0)
|
||||
{
|
||||
MsgError = ObjMov.MensajePolizaDescuadre;
|
||||
ModExtensiones.GuardaLogAD($"Bancos/IE PAGO ACREEDOR | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas");
|
||||
}
|
||||
}
|
||||
|
||||
//CONTABILIZA
|
||||
if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad)
|
||||
{
|
||||
if (IDCtaContableAcreedor > 0 && IDCtaContableBancos > 0)
|
||||
{
|
||||
if (ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa))
|
||||
{
|
||||
IDPoliza = ObjMov.ContaIdPoliza;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IDCtaContableAcreedor < 1)
|
||||
{
|
||||
Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
if (IDCtaContableBancos < 1)
|
||||
{
|
||||
Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MsgError.Equals(""))
|
||||
{
|
||||
if (Msg.ToString().Equals(""))
|
||||
{
|
||||
Msg.Append("El Documento se guardo correctamente");
|
||||
}
|
||||
System.IO.FileInfo archivo = null;
|
||||
|
||||
if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(2, 8, 9))
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta));
|
||||
}
|
||||
else if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(1))
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuentaPrestamo.SelectedValue.ToEntero()));
|
||||
|
||||
if (!archivo.Exists)
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory));
|
||||
}
|
||||
}
|
||||
else if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72)
|
||||
{
|
||||
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuentaPrestamo.SelectedValue.ToEntero()));
|
||||
}
|
||||
|
||||
//if (archivo.Length > 0)
|
||||
//{
|
||||
// if (archivo.Exists)
|
||||
// {
|
||||
// Msg.AppendFormat(@"<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">{1}</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem));
|
||||
// }
|
||||
//}
|
||||
|
||||
if (IDPoliza > 0)
|
||||
{
|
||||
Msg.AppendFormat(@"<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza);
|
||||
}
|
||||
ObjIE.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjIE.RollBack();
|
||||
Alert(MsgError, TipoMensaje.MsgError);
|
||||
}
|
||||
|
||||
if (!Msg.ToString().Equals(""))
|
||||
{
|
||||
string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery);
|
||||
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery));
|
||||
}
|
||||
|
||||
ObjIE.Dispose();
|
||||
ObjMov.Dispose();
|
||||
|
||||
if (ObjComp != null)
|
||||
ObjComp.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region"AUXILIAR"
|
||||
protected void CargaAuxiliar()
|
||||
{
|
||||
string FechaI, FechaF;
|
||||
|
||||
if (txtFechaI.Text != "")
|
||||
FechaI = txtFechaI.Text;
|
||||
else
|
||||
FechaI = "-1";
|
||||
if (txtFechaF.Text != "")
|
||||
FechaF = txtFechaF.Text;
|
||||
else
|
||||
FechaF = "-1";
|
||||
int CveProveedor = -1;
|
||||
if (DdlProveedorAuxiliar.SelectedValue.ToEntero() > 0) CveProveedor = DdlProveedorAuxiliar.SelectedValue.ToEntero();
|
||||
|
||||
ClsBancos bancos = new ClsBancos();
|
||||
if (bancos.GetAcreedoresAuxiliar(CveProveedor, FechaI, FechaF, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvAuxiliar.DataSource = bancos.DtResultados;
|
||||
|
||||
}
|
||||
bancos.Dispose();
|
||||
GvAuxiliar.DataBind();
|
||||
UpAuxiliar.Update();
|
||||
}
|
||||
|
||||
protected void BtnConsultarAuxiliar_Click(object sender, EventArgs e)
|
||||
{
|
||||
CargaAuxiliar();
|
||||
}
|
||||
|
||||
protected void GvAuxiliar_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region"REPORTE"
|
||||
protected void CargaReporte()
|
||||
{
|
||||
ClsBancos bancos = new ClsBancos();
|
||||
if (bancos.GetAcreedoresReporte(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvReporte.DataSource = bancos.DtResultados;
|
||||
GvReporte.DataBind();
|
||||
}
|
||||
bancos.Dispose();
|
||||
UpReporte.Update();
|
||||
}
|
||||
protected void GvReporte_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveProveedor") == "") e.Row.CssClass = "SubTotales";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
protected void DdlOtrosPagos_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (DdlOtrosPagos.SelectedValue != "-1")
|
||||
{
|
||||
TxtOtrosImportes.Visible = true;
|
||||
TxtTotal.Visible = true;
|
||||
GvMovAcreedor.Columns[8].Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TxtOtrosImportes.Visible = false;
|
||||
TxtTotal.Visible = false;
|
||||
GvMovAcreedor.Columns[8].Visible = false;
|
||||
TxtOtrosImportes.Text = "";
|
||||
TxtTotal.Text = "";
|
||||
RegistraScript($"$get('TxtImporte').value = FormatoNumero(SumaValores({CveMonedaCuentaPago}), 2);");
|
||||
}
|
||||
UpDatos.Update();
|
||||
UpMovAcreedor.Update();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user