예제 #1
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            //Generar Cartas
            try
            {
                try
                {
                    DataSet    ds         = new DataSet();
                    CobranzaBE CobranzaBE = new CobranzaBE()
                    {
                        OPCION     = 10,
                        USUARIO    = General.General.GetUsuario,
                        dtRegistro = dtFechaFilter.Value
                    };

                    CobranzaBL CobranzaBL = new CobranzaBL();
                    ds = CobranzaBL.ProcesarCobranza(CobranzaBE);

                    Crystal.crRptCargoDocum          ocrLoteLiquidacion       = new Crystal.crRptCargoDocum();
                    Reportes.frmVisorLoteLiquidacion ofrmVisorLoteLiquidacion = new Reportes.frmVisorLoteLiquidacion();
                    ofrmVisorLoteLiquidacion.crvVisorLoteLiq.ReportSource = ocrLoteLiquidacion;
                    ocrLoteLiquidacion.SetDataSource(ds.Tables[0]);
                    ocrLoteLiquidacion.SetParameterValue("usuario", General.General.GetUsuario);
                    ofrmVisorLoteLiquidacion.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet    ds         = new DataSet();
                CobranzaBE CobranzaBE = new CobranzaBE()
                {
                    OPCION  = 1,
                    USUARIO = General.General.GetUsuario,
                    Entidad = TextBoxX1.Text.Trim()
                };

                ds = CobranzaBL.ProcesarCobranza(CobranzaBE);
                dgvCobranza.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);
            }
        }
예제 #3
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet    ds         = new DataSet();
                CobranzaBE CobranzaBE = new CobranzaBE()
                {
                    OPCION     = 8,
                    USUARIO    = General.General.GetUsuario,
                    dtRegistro = dtRegistroFiltro.Value,
                    Status     = cboIdEstado_tt.SelectedValue.ToString()
                };

                ds = CobranzaBL.ProcesarCobranza(CobranzaBE);
                dgvCobranza.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);
            }
        }
예제 #4
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet    ds         = new DataSet();
                CobranzaBE CobranzaBE = new CobranzaBE()
                {
                    OPCION     = 9,
                    USUARIO    = General.General.GetUsuario,
                    dtRegistro = dtFechaFilter.Value
                };

                CobranzaBL CobranzaBL = new CobranzaBL();
                ds = CobranzaBL.ProcesarCobranza(CobranzaBE);
                dgvEnvioCargo.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 btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                // Obtener la variable general de validación
                TableBaseBE oEntityTable = new TableBaseBE();
                oEntityTable.OPCION   = 1;
                oEntityTable.USUARIO  = General.General.GetUsuario;
                oEntityTable.Table_Id = "01175"; //Porcentaje Validacion Cobranzas
                DataSet ds = new TableBaseBL().ProcesarTableBase(oEntityTable);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    PrjLimiteVal = decimal.Parse(ds.Tables[0].Rows[0]["Table_Value"].ToString());
                }

                TotalizarDepositos();
                TotalizarImporteDoc();
                Decimal Total          = string.IsNullOrEmpty(lblSaltoXAplicar.Text) ? 0 : Convert.ToDecimal(lblSaltoXAplicar.Text);
                Decimal AcImporteTotal = string.IsNullOrEmpty(txtTotalImp.Text) ? 0 : Convert.ToDecimal(txtTotalImp.Text);

                //if (AcImporteTotal != Total)
                //{
                //    MessageBox.Show("La distribución del depósito debe ser igual que el importe del depósito", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //    return;
                //}

                //Validacion, el monto a cancelar no debe ser menor igual del 90%
                Decimal AcnvImporte   = 0;
                Decimal AcMontoCobrar = 0;
                Decimal nMontoCobrar  = 0;
                Decimal nDifCobrada   = 0;

                bool IsError = false;
                foreach (DataGridViewRow row in dgvDocumentos.Rows)
                {
                    AcnvImporte   = AcnvImporte + (Decimal)row.Cells["nvImporte"].Value;
                    AcMontoCobrar = AcMontoCobrar + (Decimal)row.Cells["nvMontoCobrar"].Value;

                    nMontoCobrar = (Decimal)row.Cells["nvMontoCobrar"].Value;
                    nDifCobrada  = (Decimal)row.Cells["DifCobrada"].Value;
                    nDifCobrada  = Math.Abs(nDifCobrada);

                    //if (PrjLimiteVal > 0)
                    //{
                    //if (((AcnvImporte / AcMontoCobrar) * 100) < PrjLimiteVal)
                    //{
                    //    IsError = true;
                    //    break;
                    //}

                    // Modif 20190708
                    if (((nDifCobrada / nMontoCobrar) * 100) > PrjLimiteVal)
                    {
                        IsError = true;
                        break;
                    }
                    //}
                }

                if (IsError)
                {
                    MessageBox.Show("El importe a cancelar excede el " + PrjLimiteVal.ToString() + "% de lo permitido, por favor verifique.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //MessageBox.Show("El importe a cancelar es mayor al 10% de lo permitido, por favor verifique.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                if (dtRegistro.Value == DateTime.MinValue)
                {
                    MessageBox.Show("Se debe ingresar una fecha", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                //Comentado por Rq. 20181012 para los previos se puede crear cobranzas con fecha futura pero al confirmar validar que la fecha sea igual al del día
                //if (dtRegistro.Value > DateTime.Now)
                //{
                //    MessageBox.Show("La fecha de cancelación no puede ser mayor a la fecha actual", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //    return;
                //}

                CobranzaBE CobranzaBE = new CobranzaBE()
                {
                    USUARIO           = General.General.GetCodigoUsuario,
                    OPCION            = 2,
                    IdCobranza        = txtIdCobranza.Text,
                    dtValuta          = dtRegistro.Value,
                    dtRegistro        = General.General.gFechaOp,                                                                //dtRegistro.Value,
                    IdTipoCobranza_tt = "00056",                                                                                 //Cobranza por Socio
                    IdMoneda_tt       = cboIdMoneda_tt.SelectedValue.ToString(),
                    nTotal            = String.IsNullOrEmpty(txtTotalImp.Text.Trim()) ? 0 : Convert.ToDecimal(txtTotalImp.Text), //lblSaltoXAplicar
                    DatosAdicionales  = txtDatosAdicionales.Text,
                };

                DataSet dsCobranza = new DataSet();
                dsCobranza = CobranzaBL.ProcesarCobranza(CobranzaBE);

                if (dsCobranza.Tables[0].Rows.Count > 0)
                {
                    this.txtIdCobranza.Text = dsCobranza.Tables[0].Rows[0]["IdCobranza"].ToString();
                    CobranzaDetalleBE oCobranzaDetBE = new CobranzaDetalleBE()
                    {
                        USUARIO    = General.General.GetCodigoUsuario,
                        OPCION     = 3,
                        IdCobranza = dsCobranza.Tables[0].Rows[0]["IdCobranza"].ToString(),
                        sdFechaOp  = General.General.gFechaOp
                    };
                    CobranzaDetalleBL.ProcesarCobranzaDetalle(oCobranzaDetBE);

                    /* Documentos */
                    foreach (var item in LstCobranzaDetalle)
                    {
                        item.USUARIO    = General.General.GetCodigoUsuario;
                        item.OPCION     = 2;
                        item.IdSocio    = txtIdSocio.Text;
                        item.IdCobranza = dsCobranza.Tables[0].Rows[0]["IdCobranza"].ToString();
                        item.nvImporte  = item.nvImporte;
                        item.sdFechaOp  = General.General.gFechaOp;
                        item.IdLote     = item.IdLote;
                        item.cItem      = item.cItem;
                        CobranzaDetalleBL.ProcesarCobranzaDetalle(item);
                    }

                    /* Depositos */
                    CobranzaPagoBE CobranzaPagoBE = new CobranzaPagoBE()
                    {
                        USUARIO    = General.General.GetCodigoUsuario,
                        OPCION     = 3,
                        IdCobranza = dsCobranza.Tables[0].Rows[0]["IdCobranza"].ToString(),
                    };
                    new CobranzaPagoBL().ProcesarCobranzaPago(CobranzaPagoBE);

                    foreach (CobranzaPagoBE oEntity in LstCobranzaPago)
                    {
                        oEntity.USUARIO    = General.General.GetCodigoUsuario;
                        oEntity.OPCION     = 2;
                        oEntity.IdCobranza = dsCobranza.Tables[0].Rows[0]["IdCobranza"].ToString();
                        new CobranzaPagoBL().ProcesarCobranzaPago(oEntity);
                    }
                }

                this.btnImprimir.PerformClick();
                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }