Example #1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            //Definitivo
            try
            {
                foreach (DataGridViewRow row in dgvEnvioCargo.Rows)
                {
                    CobranzaDetalleBE CobranzaDetalleBE = new CobranzaDetalleBE()
                    {
                        OPCION      = 6,
                        USUARIO     = General.General.GetUsuario,
                        sdFechaOp   = General.General.gFechaOp,
                        IdCobranza  = row.Cells["IdCobranza"].Value.ToString(),
                        IdDocumento = row.Cells["IdDocumento"].Value.ToString(),
                        cNumDoc     = row.Cells["cNumDoc"].Value.ToString(),
                    };

                    CobranzaDetalleBL CobranzaDetalleBL = new CobranzaDetalleBL();
                    CobranzaDetalleBL.ProcesarCobranzaDetalle(CobranzaDetalleBE);
                }
                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnBuscar_Click(new object(), new EventArgs());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet           ds = new DataSet();
                CobranzaDetalleBL CobranzaDetalleBL = new CobranzaDetalleBL();
                CobranzaDetalleBE CobranzaDetalleBE = new CobranzaDetalleBE()
                {
                    OPCION        = 7,
                    USUARIO       = General.General.GetUsuario,
                    sdFechaOp     = General.General.gFechaOp,
                    sdVencimiento = dtFechaFiltro.Value
                };

                ds = CobranzaDetalleBL.ProcesarCobranzaDetalle(CobranzaDetalleBE);
                dgvCobranzaDetalle.DataSource = ds.Tables[0];
                lblRegistros.Text             = ds.Tables[0].Rows.Count.ToString() + " registro(s)";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                if (rdbFecha.Checked && dtFechaFilter.Text.Equals(string.Empty))
                {
                    MessageBox.Show("Debe ingresar una fecha", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    dtFechaFilter.Focus();
                    return;
                }

                if (rdbPagadora.Checked && txtIdPagadora.Text.Equals(string.Empty))
                {
                    MessageBox.Show("Seleccione una pagadora", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    btnBuscarPagadora.Focus();
                    return;
                }

                DataSet           ds = new DataSet();
                CobranzaDetalleBE CobranzaDetalleBE = new CobranzaDetalleBE()
                {
                    OPCION        = 9,
                    USUARIO       = General.General.GetUsuario,
                    sdVencimiento = rdbFecha.Checked ? dtFechaFilter.Value : DateTime.MinValue,
                    IdPagadora    = rdbPagadora.Checked ? txtIdPagadora.Text.Trim(): string.Empty
                };

                CobranzaDetalleBL CobranzaDetalleBL = new CobranzaDetalleBL();
                ds = CobranzaDetalleBL.ProcesarCobranzaDetalle(CobranzaDetalleBE);
                dgvDatos.DataSource = ds.Tables[0];
                lblRegistros.Text   = ds.Tables[0].Rows.Count.ToString() + " registro(s)";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void frmTituloValorProtestarVisor_Load(object sender, EventArgs e)
        {
            try
            {
                DataSet           ds = new DataSet();
                CobranzaDetalleBL CobranzaDetalleBL = new CobranzaDetalleBL();
                CobranzaDetalleBE CobranzaDetalleBE = new CobranzaDetalleBE()
                {
                    OPCION        = 7,
                    USUARIO       = General.General.GetUsuario,
                    sdFechaOp     = General.General.gFechaOp,
                    sdVencimiento = _dtFechaFiltro
                };

                ds = CobranzaDetalleBL.ProcesarCobranzaDetalle(CobranzaDetalleBE);
                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));
                reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = 0;
            DataSet      ds           = new DataSet();

            try
            {
                if (dgvCobranza.RowCount > 0)
                {
                    if (dgvCobranza.CurrentRow.Cells["Status"].Value.ToString() != "A")
                    {
                        MessageBox.Show("Esta cobranza ya esta confirmada", "InformaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    General.General.ValidarTipoCambio();
                    dialogResult = MessageBox.Show("Seguro de confirmar la cobranza Nro. " + dgvCobranza.CurrentRow.Cells["IdCobranza"].Value.ToString().Trim(), "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.Yes)
                    {
                        //Confirma el detalle
                        string   IdCobranza  = dgvCobranza.CurrentRow.Cells["IdCobranza"].Value.ToString().Trim();
                        string   IdMoneda_tt = dgvCobranza.CurrentRow.Cells["IdMoneda_tt"].Value.ToString().Trim();
                        DateTime dtRegistro  = Convert.ToDateTime(dgvCobranza.CurrentRow.Cells["Fecha"].Value.ToString().Trim());
                        int      iMonedaID   = IdMoneda_tt == "00036" ? 1 : 2;

                        BindingList <CobranzaDetalleBE> LstCobranzaDetalle = new BindingList <CobranzaDetalleBE>();
                        DataSet           dsDetaLote         = new DataSet();
                        CobranzaDetalleBE oCobranzaDetalleBE = new CobranzaDetalleBE()
                        {
                            USUARIO    = General.General.GetCodigoUsuario,
                            OPCION     = 1,
                            IdCobranza = IdCobranza,
                            sdFechaOp  = General.General.gFechaOp
                        };
                        dsDetaLote = new CobranzaDetalleBL().ProcesarCobranzaDetalle(oCobranzaDetalleBE);
                        if (dsDetaLote.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < dsDetaLote.Tables[0].Rows.Count; i++)
                            {
                                CobranzaDetalleBE oCobranzadetBE = new CobranzaDetalleBE()
                                {
                                    IdLote       = dsDetaLote.Tables[0].Rows[i]["IdLote"].ToString(),
                                    cItem        = dsDetaLote.Tables[0].Rows[i]["cItem"].ToString(),
                                    IdDocumento  = dsDetaLote.Tables[0].Rows[i]["IdDocumento"].ToString(),
                                    IdSocio      = dsDetaLote.Tables[0].Rows[i]["IdSocio"].ToString(),
                                    IdSocio_Dsc  = dsDetaLote.Tables[0].Rows[i]["IdSocio_Dsc"].ToString(),
                                    vDocumento   = dsDetaLote.Tables[0].Rows[i]["vDocumento"].ToString(),
                                    cNumDoc      = dsDetaLote.Tables[0].Rows[i]["cNumDoc"].ToString(),
                                    nvNominal    = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["nvNominal"].ToString()),
                                    nvNegociable = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["nvNegociable"].ToString()),
                                    nvImporte    = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["nvImporte"].ToString()),
                                    DifCobrada   = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["DifCobrada"].ToString()),
                                    Interes      = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["Interes"].ToString()),
                                    Garantia     = Decimal.Parse(dsDetaLote.Tables[0].Rows[i]["Garantia"].ToString()),
                                };
                                LstCobranzaDetalle.Add(oCobranzadetBE);
                            }
                        }

                        CobranzaBE oCobranza = new CobranzaBE()
                        {
                            USUARIO    = General.General.GetCodigoUsuario,
                            OPCION     = 6,
                            IdCobranza = IdCobranza,
                            dtRegistro = General.General.gFechaOp,
                            dtValuta   = General.General.gFechaOp,
                            iMonedaID  = iMonedaID,
                            gPlazaID   = General.General.gPlazaID,
                            gSesionID  = General.General.gSesionID,
                            gFechaOp   = General.General.gFechaOp
                        };
                        bool bResult = CobranzaBL.ProcesarCobranza(oCobranza, LstCobranzaDetalle);
                        if (bResult)
                        {
                            //oCobranza = new CobranzaBE()
                            //{
                            //    USUARIO = General.General.GetCodigoUsuario,
                            //    OPCION = 12,
                            //    IdCobranza = IdCobranza,
                            //    dtRegistro = General.General.gFechaOp,
                            //    dtValuta = General.General.gFechaOp,
                            //    gPlazaID = General.General.gPlazaID,
                            //    gSesionID = General.General.gSesionID,
                            //    gFechaOp = General.General.gFechaOp
                            //};
                            //CobranzaBL.ProcesarCobranza(oCobranza);

                            MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            //Impresion
                            DataSet dsCobranza = new DataSet();
                            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConexionStrDBEfideFactoring"].ConnectionString))
                            {
                                SqlCommand cmd1 = new SqlCommand("Rpt_CobranzaP_Cab", con);
                                cmd1.CommandType = CommandType.StoredProcedure;
                                cmd1.Parameters.AddWithValue("@IdCobranza", IdCobranza);
                                SqlDataAdapter daCab = new SqlDataAdapter(cmd1);
                                daCab.Fill(dsCobranza, "Rpt_CobranzaP_Cab");

                                SqlCommand cmd2 = new SqlCommand("Rpt_CobranzaP_Det", con);
                                cmd2.CommandType = CommandType.StoredProcedure;
                                cmd2.Parameters.AddWithValue("@IdCobranza", IdCobranza);
                                SqlDataAdapter daDet = new SqlDataAdapter(cmd2);
                                daDet.Fill(dsCobranza, "Rpt_CobranzaP_Det");

                                SqlCommand cmd3 = new SqlCommand("Rpt_CobranzaPago", con);
                                cmd3.CommandType = CommandType.StoredProcedure;
                                cmd3.Parameters.AddWithValue("@IdCobranza", IdCobranza);
                                SqlDataAdapter daDet2 = new SqlDataAdapter(cmd3);
                                daDet2.Fill(dsCobranza, "Rpt_CobranzaPago");

                                con.Close();
                            }

                            Crystal.crRptCobranzaPagadora    ocrLoteLiquidacion       = new Crystal.crRptCobranzaPagadora();
                            Reportes.frmVisorLoteLiquidacion ofrmVisorLoteLiquidacion = new Reportes.frmVisorLoteLiquidacion();
                            ofrmVisorLoteLiquidacion.crvVisorLoteLiq.ReportSource = ocrLoteLiquidacion;
                            ocrLoteLiquidacion.SetDataSource(dsCobranza);
                            ocrLoteLiquidacion.SetParameterValue("FechaCancelacion", dtRegistro);
                            ocrLoteLiquidacion.SetParameterValue("Usuario", General.General.GetUsuario);
                            ofrmVisorLoteLiquidacion.WindowState = FormWindowState.Maximized;
                            ofrmVisorLoteLiquidacion.ShowDialog();
                        }

                        //foreach (var item in LstCobranzaDetalle)
                        //{
                        //    item.USUARIO = General.General.GetCodigoUsuario;
                        //    item.OPCION = 5;
                        //    item.IdPagadora = item.IdPagadora;
                        //    item.IdSocio = item.IdSocio;
                        //    item.IdCobranza = IdCobranza;
                        //    item.nvImporte = item.nvImporte;
                        //    item.sdFechaOp = General.General.gFechaOp;
                        //    item.gSesionID = General.General.gSesionID;
                        //    item.gPlazaID = General.General.gPlazaID;
                        //    item.valorMonedaID = iMonedaID;
                        //    item.IdLote = item.IdLote;
                        //    item.cItem = item.cItem;
                        //    new CobranzaDetalleBL().ProcesarCobranzaDetalle(item);
                        //}
                        btnBuscar.PerformClick();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }