private void btnBuscarPagadora_Click(object sender, EventArgs e)
        {
            try
            {
                Formula.Consulta.frmBusquedaPagadora ofrmBusquedaPagadora = new Formula.Consulta.frmBusquedaPagadora();
                ofrmBusquedaPagadora.ShowDialog();

                DataSet    dsPagadora = new DataSet();
                PagadoraBE PagadoraBE = new PagadoraBE()
                {
                    OPCION     = 4,
                    USUARIO    = General.General.GetCodigoUsuario,
                    IdPagadora = ofrmBusquedaPagadora.CodigoPagadora.ToString()
                };

                dsPagadora = new PagadoraBL().ProcesarPagadora(PagadoraBE);

                if (dsPagadora.Tables[0].Rows.Count > 0)
                {
                    txtIdPagadora.Text  = dsPagadora.Tables[0].Rows[0]["IdPagadora"].ToString();
                    txtDescripcion.Text = dsPagadora.Tables[0].Rows[0]["vcPagadora"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = 0;

            try
            {
                if (dgvPagadoras.RowCount > 0)
                {
                    dialogResult = MessageBox.Show("Seguro de eliminar a la Pagadora: " + dgvPagadoras.CurrentRow.Cells["vcPagadora"].Value.ToString().Trim(), "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.Yes)
                    {
                        PagadoraBE PagadoraBE = new PagadoraBE();
                        PagadoraBE.OPCION     = 3;
                        PagadoraBE.USUARIO    = General.General.GetCodigoUsuario;
                        PagadoraBE.IdPagadora = dgvPagadoras.CurrentRow.Cells["IdPagadora"].Value.ToString();
                        PagadoraBL.ProcesarPagadora(PagadoraBE);
                        MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        btnBuscar.PerformClick();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void txtRucPagadora_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (txtRucPagadora.Text.Trim().Length == 11)
                {
                    PagadoraBE oEntity = new PagadoraBE()
                    {
                        OPCION  = 7,
                        USUARIO = General.General.GetCodigoUsuario,
                        vcRuc   = txtRucPagadora.Text
                    };
                    DataSet ds = new PagadoraBL().ProcesarPagadora(oEntity);

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        IdPagadora                   = ds.Tables[0].Rows[0]["IdPagadora"].ToString();
                        txtvcPagadora.Text           = ds.Tables[0].Rows[0]["vcPagadora"].ToString();
                        cboidsector_tt.SelectedValue = ds.Tables[0].Rows[0]["IdSector_tt"].ToString();
                        txtnLineaDisp.Text           = Convert.ToDecimal(ds.Tables[0].Rows[0]["LineaDisponible"].ToString()).ToString("N2");
                        txtOrigen.Text               = ds.Tables[0].Rows[0]["Tipo"].ToString();
                        txtEstadoLinea.Text          = ds.Tables[0].Rows[0]["EstadoLinea"].ToString();
                        txtObservacion.Text          = ds.Tables[0].Rows[0]["Observacion"].ToString();
                    }
                    else
                    {
                        txtOrigen.Text = "NRL";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                PagadoraBE oEntity = new PagadoraBE()
                {
                    OPCION        = 11,
                    USUARIO       = General.General.GetUsuario,
                    IdPagadora    = txtIdPagadora.Text,
                    IdGestor      = cboEjecutivo.SelectedValue.ToString(),
                    dtFechaInicio = dtFechaInicio.Value == null ? DateTime.MinValue : dtFechaInicio.Value,
                    dtFechaFin    = dtFechaFin.Value == null ? DateTime.MinValue : dtFechaFin.Value,
                    FlgInactivo   = ChkInactivos.Checked ? 1 : 0,
                    FlgBloqueado  = ChkBloqueados.Checked ? 1 : 0,
                };
                DataSet ds = new DataSet();
                ds = new PagadoraBL().ProcesarPagadora(oEntity);
                dgvPagadoras.DataSource = ds.Tables[0];
                lblNRegistros.Text      = ds.Tables[0].Rows.Count.ToString() + " registro(s)";

                ((CheckBox)dgvPagadoras.Controls.Find("ChkSelAsignar", true)[0]).Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #5
0
        private void btnAgregarPagadora_Click(object sender, EventArgs e)
        {
            try
            {
                Formula.Consulta.frmBusquedaPagadora ofrmBusquedaPagadora = new Consulta.frmBusquedaPagadora();
                ofrmBusquedaPagadora.ShowDialog();

                DataSet    dsPagadora = new DataSet();
                PagadoraBE PagadoraBE = new PagadoraBE()
                {
                    OPCION     = 1,
                    USUARIO    = General.General.GetCodigoUsuario,
                    IdPagadora = ofrmBusquedaPagadora.CodigoPagadora.ToString()
                };

                dsPagadora = PagadoraBL.ProcesarPagadora(PagadoraBE);

                if (dsPagadora.Tables[0].Rows.Count > 0)
                {
                    if (Operacion.Equals("M"))
                    {
                        if (dtPagadoras.Rows.Count == 0)
                        {
                            foreach (DataGridViewRow row in dgvPagadoras.Rows)
                            {
                                dtPagadoras.Rows.Add(row.Cells["IdPagadora"].Value, row.Cells["Pagadora"].Value);
                            }
                        }

                        dtPagadoras.Rows.Add(dsPagadora.Tables[0].Rows[0]["IdPagadora"].ToString(), dsPagadora.Tables[0].Rows[0]["vcPagadora"].ToString());
                        dgvPagadoras.DataSource = dtPagadoras;
                        dgvPagadoras.Refresh();
                        return;
                    }

                    dtPagadoras.Rows.Add(dsPagadora.Tables[0].Rows[0]["IdPagadora"].ToString(), dsPagadora.Tables[0].Rows[0]["vcPagadora"].ToString());
                    dgvPagadoras.Refresh();
                }

                lblRegistros.Text = dtPagadoras.Rows.Count.ToString() + " registro(s)";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet    dsPagadora = new DataSet();
         PagadoraBE PagadoraBE = new PagadoraBE();
         PagadoraBE.OPCION       = 4;
         PagadoraBE.USUARIO      = General.General.GetCodigoUsuario;
         PagadoraBE.vcPagadora   = txtvcPagadora.Text.Trim();
         dsPagadora              = PagadoraBL.ProcesarPagadora(PagadoraBE);
         dgvPagadoras.DataSource = dsPagadora.Tables[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public DataSet ProcesarPagadora(PagadoraBE BE)
        {
            DataSet dsResult;

            try
            {
                cmd = db.GetStoredProcCommand("Pagadora_Mnt");
                db.AddInParameter(cmd, "OPCION", DbType.Int32, BE.OPCION);
                db.AddInParameter(cmd, "USUARIO", DbType.String, BE.USUARIO);
                db.AddInParameter(cmd, "IdPagadora", DbType.String, BE.IdPagadora);
                db.AddInParameter(cmd, "vcPagadora", DbType.String, BE.vcPagadora);
                db.AddInParameter(cmd, "vcNComercial", DbType.String, BE.vcNComercial);
                db.AddInParameter(cmd, "vcNombreCPagadora", DbType.String, BE.vcNombreCPagadora);
                db.AddInParameter(cmd, "bNacional", DbType.Boolean, BE.bNacional);
                db.AddInParameter(cmd, "vcRuc", DbType.String, BE.vcRuc);
                db.AddInParameter(cmd, "vcPartida", DbType.String, BE.vcPartida);
                db.AddInParameter(cmd, "IdSector_tt", DbType.String, BE.IdSector_tt);
                db.AddInParameter(cmd, "IdRiesgo_tt", DbType.String, BE.IdRiesgo_tt);
                db.AddInParameter(cmd, "vcDireccion", DbType.String, BE.vcDireccion);
                db.AddInParameter(cmd, "IdUbigeo", DbType.String, BE.IdUbigeo);
                db.AddInParameter(cmd, "vcReferencia", DbType.String, BE.vcReferencia);
                db.AddInParameter(cmd, "FlgIndividualReporte", DbType.String, BE.FlgIndividualReporte);
                db.AddInParameter(cmd, "FlgConvenio", DbType.String, BE.FlgConvenio);
                if (BE.dtFechaInicio != DateTime.MinValue)
                {
                    db.AddInParameter(cmd, "dtFechaInicio", DbType.DateTime, BE.dtFechaInicio);
                }
                if (BE.dtFechaFin != DateTime.MinValue)
                {
                    db.AddInParameter(cmd, "dtFechaFin", DbType.DateTime, BE.dtFechaFin);
                }
                db.AddInParameter(cmd, "FlgInactivo", DbType.Int32, BE.FlgInactivo);
                db.AddInParameter(cmd, "FlgBloqueado", DbType.Int32, BE.FlgBloqueado);
                db.AddInParameter(cmd, "IdEstadoLinea_tt", DbType.String, BE.IdEstadoLinea_tt);
                db.AddInParameter(cmd, "IdGestor", DbType.String, BE.IdGestor);
                db.AddInParameter(cmd, "UsuarioID", DbType.String, BE.UsuarioID);
                dsResult = db.ExecuteDataSet(cmd);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(dsResult);
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet    dsPagadora = new DataSet();
                PagadoraBE PagadoraBE = new PagadoraBE();
                PagadoraBE.OPCION       = 1;
                PagadoraBE.USUARIO      = General.General.GetCodigoUsuario;
                PagadoraBE.vcPagadora   = TextBoxX1.Text.Trim();
                PagadoraBE.vcRuc        = txtRuc.Text.Trim();
                dsPagadora              = PagadoraBL.ProcesarPagadora(PagadoraBE);
                dgvPagadoras.DataSource = dsPagadora.Tables[0];

                lblRegistros.Text = dsPagadora.Tables[0].Rows.Count + " registro(s)";
                GridFormating();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #9
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialogResult = 0;

                if (string.IsNullOrEmpty(cboIdEstadoLinea_tt.SelectedValue.ToString()))
                {
                    MessageBox.Show("Debe seleccionar el tipo de bloqueo de la línea", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboIdEstadoLinea_tt.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtMotivo.Text.Trim()))
                {
                    MessageBox.Show("Ingrese el motivo del bloqueo de la línea", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtMotivo.Focus();
                    return;
                }

                dialogResult = MessageBox.Show("¿Seguro de bloquear a la Pagadora?" + _vcPagadora, "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogResult == DialogResult.Yes)
                {
                    PagadoraBE PagadoraBE = new PagadoraBE();
                    PagadoraBE.OPCION           = 5;
                    PagadoraBE.USUARIO          = General.General.GetCodigoUsuario;
                    PagadoraBE.IdPagadora       = Codigo;
                    PagadoraBE.IdEstadoLinea_tt = cboIdEstadoLinea_tt.SelectedValue.ToString();
                    PagadoraBE.vcReferencia     = txtMotivo.Text;
                    new PagadoraBL().ProcesarPagadora(PagadoraBE);
                    MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #10
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvPagadoras.Rows.Count == 0)
                {
                    MessageBox.Show("Deben existir pagadoras", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboUsuarios.Focus();
                    return;
                }

                int nCount = 0;

                foreach (DataGridViewRow row in dgvPagadoras.Rows)
                {
                    DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[0];
                    if (chk.Value != null)
                    {
                        if (chk.Value.ToString().Equals("True"))
                        {
                            PagadoraBE oEntity = new PagadoraBE()
                            {
                                OPCION     = 12,
                                USUARIO    = General.General.GetUsuario,
                                IdPagadora = row.Cells["IdPagadora"].Value.ToString(),
                            };
                            new PagadoraBL().ProcesarPagadora(oEntity);
                            nCount += 1;
                        }
                    }
                }

                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnBuscar.PerformClick();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #11
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtvcReferencia.Text.Trim()))
                {
                    MessageBox.Show("Debe ingresar un comentario para el desbloqueo de la pagadora.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtvcReferencia.Focus();
                    return;
                }

                if (txtvcReferencia.Text.Trim().Length <= 30)
                {
                    MessageBox.Show("El comentario debe tener más de 30 caracteres.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtvcReferencia.Focus();
                    return;
                }

                DialogResult dialogResult = 0;
                dialogResult = MessageBox.Show("Seguro de desbloquear a la pagadora: " + _IdPagadora_Dsc, "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogResult == DialogResult.Yes)
                {
                    PagadoraBE PagadoraBE = new PagadoraBE();
                    PagadoraBE.OPCION       = 6;
                    PagadoraBE.USUARIO      = General.General.GetCodigoUsuario;
                    PagadoraBE.IdPagadora   = _IdPagadora;
                    PagadoraBE.vcReferencia = txtvcReferencia.Text;
                    new PagadoraBL().ProcesarPagadora(PagadoraBE);
                    _Result = "OK";
                    this.Dispose();
                    MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void LectorXML(String file_path, int Contador)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(file_path);
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                nsmgr.AddNamespace("tns", "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2");
                nsmgr.AddNamespace("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2");
                nsmgr.AddNamespace("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2");

                XmlNode node    = xmlDoc.SelectSingleNode("/tns:Invoice/cbc:UBLVersionID", nsmgr); //Version
                string  Version = node.InnerText.ToString();

                string strRucSocio     = string.Empty;                                                                                                   //RUC Socio
                string strRucPagadora  = string.Empty;                                                                                                   //RUC Pagadora
                string strFechaEmision = xmlDoc.SelectSingleNode("/tns:Invoice/cbc:IssueDate", nsmgr).InnerText;                                         //Fecha de Emision
                string strNroDoc       = xmlDoc.SelectSingleNode("/tns:Invoice/cac:Signature/cbc:ID", nsmgr).InnerText;                                  //Serie y número
                string strMoneda       = xmlDoc.SelectSingleNode("/tns:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount//@currencyID", nsmgr).InnerText; //Moneda
                string strImpuesto     = xmlDoc.SelectSingleNode("/tns:Invoice/cac:TaxTotal/cbc:TaxAmount", nsmgr).InnerText;                            //Impuesto
                string strMonto        = xmlDoc.SelectSingleNode("/tns:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount", nsmgr).InnerText;              //Monto

                if (Version.Equals("2.0"))
                {
                    strRucSocio    = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingSupplierParty//cbc:CustomerAssignedAccountID", nsmgr).InnerText; //RUC Socio
                    strRucPagadora = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingCustomerParty//cbc:CustomerAssignedAccountID", nsmgr).InnerText; //RUC Pagadora
                }
                else if (Version.Equals("2.1"))
                {
                    strRucSocio    = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID", nsmgr).InnerText; //RUC Socio
                    strRucPagadora = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification/cbc:ID", nsmgr).InnerText; //RUC Pagadora
                }
                else
                {
                    MessageBox.Show("Versión del XML no soportada - " + Version, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (Contador == 0)
                {
                    if (!ObtenerLinea(strRucSocio, strMoneda))
                    {
                        Contador    = 1;
                        IdLinea     = string.Empty;
                        IdMoneda_tt = string.Empty;
                        txtIdSocio.Clear();
                        txtIdSocio_Dsc.Clear();
                        txtIdLinea_Dsc.Clear();
                        txtIdMoneda_tt_Dsc.Clear();
                        txtFecha.Clear();
                        txtIdTipoLinea_tt_Dsc.Clear();
                        txtCarpetaXML.Clear();
                        IdFormaDesembolso = 0;
                        MessageBox.Show("No se encontro ninguna linea del socio, por favor verifique.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        IsError = true;
                        return;
                    }
                }

                string     IdPagadora     = string.Empty;
                string     IdPagadora_Dsc = string.Empty;
                PagadoraBE oEntityPag     = new PagadoraBE()
                {
                    OPCION = 1,
                    vcRuc  = strRucPagadora
                };
                DataSet dsPag = new PagadoraBL().ProcesarPagadora(oEntityPag);

                if (dsPag.Tables[0].Rows.Count > 0)
                {
                    IdPagadora     = dsPag.Tables[0].Rows[0]["IdPagadora"].ToString();
                    IdPagadora_Dsc = dsPag.Tables[0].Rows[0]["vcPagadora"].ToString();
                }

                DocumentoBE oEntityDoc = new DocumentoBE()
                {
                    OPCION      = 4,
                    IdDocumento = "00010"
                };
                DataSet dsDoc = new DocumentoBL().ProcesarDocumento(oEntityDoc);

                string IdDocumento_Dsc = string.Empty;
                if (dsDoc.Tables[0].Rows.Count > 0)
                {
                    IdDocumento_Dsc = dsDoc.Tables[0].Rows[0]["cAbreviatura"].ToString();
                }

                SocioLineaPagDocBE oEntityPagDoc = new SocioLineaPagDocBE();
                oEntityPagDoc.OPCION      = 1;
                oEntityPagDoc.IdLinea     = IdLinea;
                oEntityPagDoc.IdPagadora  = IdPagadora;
                oEntityPagDoc.IdDocumento = "00010"; // Factura Electronica
                DataSet dsPagDoc = new SocioLineaPagDocBL().ProcesarSocioLineaPagDoc(oEntityPagDoc);

                string IdTipoConfirmacion_Dsc = string.Empty;
                if (dsPagDoc.Tables[0].Rows.Count > 0)
                {
                    IdTipoConfirmacion_Dsc = dsPagDoc.Tables[0].Rows[0]["IdTipoConfirmacion_Dsc"].ToString();
                }

                FEXMLBE IEntity = new FEXMLBE()
                {
                    IdPagadora              = IdPagadora,
                    IdPagadora_Dsc          = IdPagadora_Dsc,
                    RUC                     = strRucPagadora,
                    IdDocumento             = "00010", // Factura Electronica
                    IdDocumento_Dsc         = IdDocumento_Dsc,
                    IdTipoConfirmacion_Dsc  = IdTipoConfirmacion_Dsc,
                    cNumDoc                 = strNroDoc,
                    nvNominal               = Convert.ToDecimal(strMonto),
                    nvNegociable            = 0,
                    Mensaje                 = string.Empty,
                    IdSocio_BeneficiarioRuc = _IdSocio_BeneficiarioRuc
                };
                LstEntityFE.Add(IEntity);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnImportar_Click(object sender, EventArgs e)
        {
            string srutaArchivo = string.Empty;

            openFileDialog1.InitialDirectory = @"C:\";
            openFileDialog1.Filter           = "Archivos de Excel (*.xls) |*.xlsx";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName         = "";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                srutaArchivo = openFileDialog1.FileName;

                try
                {
                    msgHelper.Wait("Cargando registros, espere un momento ...");
                    cnExcel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + srutaArchivo + ";Extended Properties='Excel 12.0 Xml;HDR=YES';");

                    if (cnExcel.State == ConnectionState.Closed)
                    {
                        cnExcel.Open();
                    }

                    if (!System.IO.File.Exists(srutaArchivo))
                    {
                        MessageBox.Show("No se encontró el Libro: " + srutaArchivo, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //daExcel = new OleDbDataAdapter("Select N_Cartera, CodClasifCar, NomClasifCar, DireccionClasifCar, " + "CodDeudorCar, '0' & TipoIdentidad as TipoIdentidad, NroIdentidad, APELLIDOSYNOMBRES, DIRECCION, DISTRITO, " + _();
                    //"PROVINCIA, DEPARTAMENTO, CODPOSTAL, TELFDOM, TELFMOV, EmpLaboral, EmpDireccion, " + "EmpDistrito, TelfLab, Sexo, Fch_nacimiento, N_Operacion, Fec_Emis, Cap_Orig, Sal_Cap, " + "InteresMor, InteresComp, Honorarios, Gastos, Pagos, Deuda_Total, IIf (Moneda='S','001',IIf (Moneda='D','002',Moneda)) as Moneda , Fec_Venc, " +
                    //"Fec_Jud, Conyugue, ANombre, ADireccion, ADistrito, Atelefono, AEmpLaboral, AEmpDireccion, " + "AEmpDistrito, AEmpTelefono, Fecha_Asig, Tipo_Cart, Producto_Orig_Deuda, LoginGA, Oficina " + "From [Data$A1:AV20000] ", cnExcel);

                    OleDbDataAdapter daExcel = new OleDbDataAdapter("Select * " +
                                                                    "From [Carga$A1:Q20000] ", cnExcel);

                    DataTable dtTable = new DataTable();
                    daExcel.Fill(dtTable);

                    //Valida que no se repita el numero de documento en la carga de datos
                    foreach (DataRow row in dtTable.Rows)
                    {
                        if (!string.IsNullOrEmpty(row["RUCPAGADORA"].ToString().Trim()))
                        {
                            string IdDocumento = row["TIPODOCUMENTO"].ToString();
                            string cNumDoc     = row["NroDOCUMENTO"].ToString();
                            string RucPagadora = row["RUCPAGADORA"].ToString();

                            //Buscar en el datatable
                            DataRow[] drResult = dtTable.Select("TIPODOCUMENTO = '" + IdDocumento + "' and NroDOCUMENTO = '" + cNumDoc + "' and RUCPAGADORA = '" + RucPagadora + "'");

                            if (drResult.Length > 1)
                            {
                                MessageBox.Show("El documento " + cNumDoc + " de la pagadora " + RucPagadora + " se está duplicando en la importación de datos.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                msgHelper.Wait();
                                return;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }

                    int Contador = 0;
                    foreach (DataRow row in dtTable.Rows)
                    {
                        if (!string.IsNullOrEmpty(row["RUCPAGADORA"].ToString().Trim()))
                        {
                            if (Contador == 0)
                            {
                                if (!ObtenerLinea(row["RUCSOCIO"].ToString(), row["TIPOMONEDA"].ToString()))
                                {
                                    IdLinea     = string.Empty;
                                    IdMoneda_tt = string.Empty;
                                    txtIdSocio.Clear();
                                    txtIdSocio_Dsc.Clear();
                                    txtIdLinea_Dsc.Clear();
                                    txtIdMoneda_tt_Dsc.Clear();
                                    txtFecha.Clear();
                                    txtIdTipoLinea_tt_Dsc.Clear();
                                    txtCarpetaXML.Clear();
                                    IdFormaDesembolso = 0;
                                    MessageBox.Show("No se encontro ninguna linea del socio, por favor verifique.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    IsError = true;
                                    return;
                                }
                            }

                            string     IdPagadora     = string.Empty;
                            string     IdPagadora_Dsc = string.Empty;
                            PagadoraBE oEntityPag     = new PagadoraBE()
                            {
                                OPCION = 1,
                                vcRuc  = row["RUCPAGADORA"].ToString().Trim()
                            };
                            DataSet dsPag = new PagadoraBL().ProcesarPagadora(oEntityPag);

                            if (dsPag.Tables[0].Rows.Count > 0)
                            {
                                IdPagadora     = dsPag.Tables[0].Rows[0]["IdPagadora"].ToString();
                                IdPagadora_Dsc = dsPag.Tables[0].Rows[0]["vcPagadora"].ToString();
                            }

                            DocumentoBE oEntityDoc = new DocumentoBE()
                            {
                                OPCION      = 4,
                                IdDocumento = row["TIPODOCUMENTO"].ToString()
                            };
                            DataSet dsDoc = new DocumentoBL().ProcesarDocumento(oEntityDoc);

                            string IdDocumento_Dsc = string.Empty;
                            if (dsDoc.Tables[0].Rows.Count > 0)
                            {
                                IdDocumento_Dsc = dsDoc.Tables[0].Rows[0]["cAbreviatura"].ToString();
                            }

                            SocioLineaPagDocBE oEntityPagDoc = new SocioLineaPagDocBE();
                            oEntityPagDoc.OPCION      = 1;
                            oEntityPagDoc.IdLinea     = IdLinea;
                            oEntityPagDoc.IdPagadora  = IdPagadora;
                            oEntityPagDoc.IdDocumento = row["TIPODOCUMENTO"].ToString();
                            DataSet dsPagDoc = new SocioLineaPagDocBL().ProcesarSocioLineaPagDoc(oEntityPagDoc);

                            string IdTipoConfirmacion_Dsc = string.Empty;
                            if (dsPagDoc.Tables[0].Rows.Count > 0)
                            {
                                IdTipoConfirmacion_Dsc = dsPagDoc.Tables[0].Rows[0]["IdTipoConfirmacion_Dsc"].ToString();
                            }

                            FEXMLBE IEntity = new FEXMLBE()
                            {
                                IdPagadora              = IdPagadora,
                                IdPagadora_Dsc          = IdPagadora_Dsc,
                                RUC                     = row["RUCPAGADORA"].ToString().Trim(),
                                IdDocumento             = row["TIPODOCUMENTO"].ToString(),
                                IdDocumento_Dsc         = IdDocumento_Dsc,
                                cNumDoc                 = row["NroDOCUMENTO"].ToString(),
                                sdVencimiento           = Convert.ToDateTime(row["FECHAPAGO"]),
                                nvNominal               = Convert.ToDecimal(row["IMPORTENETODEPAGO"]),
                                nvNegociable            = Convert.ToDecimal(row["IMPORTENETODEPAGO"]),
                                IdTipoConfirmacion_Dsc  = IdTipoConfirmacion_Dsc,
                                IdSocio_BeneficiarioRuc = _IdSocio_BeneficiarioRuc,
                                Mensaje                 = string.Empty
                            };
                            LstEntityFE.Add(IEntity);
                            Contador++;
                        }
                    }

                    dgvFEDetalle.DataSource = LstEntityFE.ToList();
                    lblnroRegistros.Text    = LstEntityFE.Count() + " registro(s)";
                    OrigenLote = 1;
                    cnExcel.Close();
                    //btnImportar.Enabled = false;
                    msgHelper.Wait();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    cnExcel.Close();
                    msgHelper.Wait();
                }
            }
        }
Beispiel #14
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvPagadoras.Rows.Count == 0)
                {
                    MessageBox.Show("Deben existir pagadoras", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboUsuarios.Focus();
                    return;
                }

                if (dgvUsuarios.Rows.Count == 0)
                {
                    MessageBox.Show("Agregar al menos un usuario para la distribución", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboUsuarios.Focus();
                    return;
                }

                int nDistribucion = Math.Abs(dgvPagadoras.Rows.Count / dgvUsuarios.Rows.Count);
                int nCountUsuario = dgvUsuarios.Rows.Count;
                int nRowUsuario   = 0;
                int nCount        = 0;

                foreach (DataGridViewRow row in dgvPagadoras.Rows)
                {
                    DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[0];
                    if (chk.Value != null)
                    {
                        if (chk.Value.ToString().Equals("True"))
                        {
                            if ((nCountUsuario - 1) != nRowUsuario)
                            {
                                if (nCount == nDistribucion)
                                {
                                    nRowUsuario += 1;
                                    nCount       = 0;
                                }
                            }

                            PagadoraBE oEntity = new PagadoraBE()
                            {
                                OPCION     = 10,
                                USUARIO    = General.General.GetUsuario,
                                IdPagadora = row.Cells["IdPagadora"].Value.ToString(),
                                IdGestor   = dgvUsuarios.Rows[nRowUsuario].Cells["gestorID"].Value.ToString(),
                            };
                            new PagadoraBL().ProcesarPagadora(oEntity);
                            nCount += 1;
                        }
                    }
                }

                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //btnLimpiar.PerformClick();
                btnBuscar.PerformClick();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public DataSet ProcesarPagadora(PagadoraBE BE)
 {
     return(PagadoraDA.ProcesarPagadora(BE));
 }