Пример #1
0
        private void frmCerrarPeriodo_Load(object sender, EventArgs e)
        {
            DataTable dtPeriodo = PeriodoContableDAC.GetPeriodoContableACerrar();

            this.txtEjercicio.Text = dtPeriodo.Rows[0]["IDEjercicio"].ToString();
            this.txtPeriodo.Text   = dtPeriodo.Rows[0]["Periodo"].ToString();
            this.txtFecha.Text     = dtPeriodo.Rows[0]["FechaFinal"].ToString();
        }
Пример #2
0
 void btnSetPeriodoTrabajo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (this.gridView.SelectedRowsCount > 0)
     {
         String sPeriodo    = _currentRow["Periodo"].ToString();
         int    IdEjercicio = (int)_currentRow["IdEjercicio"];
         if (PeriodoContableDAC.SetPeriodoTrabajoActivo(IdEjercicio, sPeriodo))
         {
             _dsPeriodo = PeriodoContableDAC.GetData((int)this.slkupEjercicio.EditValue, "*");
             PopulateGrid();
         }
     }
 }
Пример #3
0
 private void slkupEjercicio_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (this.slkupEjercicio.EditValue != null && this.slkupEjercicio.EditValue.ToString() != "")
         {
             _dsPeriodo = PeriodoContableDAC.GetData((int)this.slkupEjercicio.EditValue, "*");
             PopulateGrid();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Esta seguro que desar cerrar el periodo contable " + txtPeriodo.Text.Trim(), "Cierre de Mes", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
     {
         //correr el proceso de cierre
         try
         {
             PeriodoContableDAC.CierraPeriodoContable(Convert.ToInt32(this.txtEjercicio.Text.Trim()), this.txtPeriodo.Text.Trim());
             MessageBox.Show("El periodo ha sido cerrado satisfactoriamente");
             this.Close();
         }
         catch (Exception ex) {
             MessageBox.Show(ex.Message);
         }
     }
 }
Пример #5
0
 private void BtnCerrarPeriodo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         if (this.gridView.SelectedRowsCount > 0)
         {
             String sPeriodo    = _currentRow["Periodo"].ToString();
             int    IdEjercicio = (int)_currentRow["IdEjercicio"];
             if (PeriodoContableDAC.CierraPeriodoContable(IdEjercicio, sPeriodo))
             {
                 _dsPeriodo = PeriodoContableDAC.GetData((int)this.slkupEjercicio.EditValue, "*");
                 PopulateGrid();
                 MessageBox.Show("El periodo contable se ha cerrado con éxito");
             }
         }
     }
     catch (Exception)
     {
     }
 }
Пример #6
0
        private void btnMayorizar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //Validar que al menos un elemento se encuentre seleccionado
            ArrayList rows = new ArrayList();

            for (int i = 0; i < this.gridView.SelectedRowsCount; i++)
            {
                if (gridView.GetSelectedRows()[i] >= 0)
                {
                    rows.Add(gridView.GetDataRow(gridView.GetSelectedRows()[i]));
                }
            }

            if (rows.Count == 0)
            {
                MessageBox.Show("Por favor chequee los elementos que desea mayorizar");
                return;
            }

            try
            {
                for (int i = 0; i < rows.Count; i++)
                {
                    DataRow row = rows[i] as DataRow;
                    // Change the field value.


                    DateTime Fecha = Convert.ToDateTime(row["Fecha"]);
                    try
                    {
                        //if (Fecha == null || PeriodoContableDAC.ValidaFechaInPeriodoContable(Fecha))
                        PeriodoContableDAC.ValidaFechaInPeriodoContable(Fecha);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Han ocurrido los siguientes errores: \r\n" + ex.Message);
                        return;
                    }

                    if (Convert.ToBoolean(row["Mayorizado"]) == false)
                    {
                        //Validar situaciones comunes al momento de mayorizar
                        String NumAsiento  = row["Asiento"].ToString();
                        int    IdEjercicio = (int)row["IDEjercicio"];// (int)_dsEjercicioPeriodo.Tables[0].Rows[0]["IDEjercicio"];
                        String Periodo     = row["Periodo"].ToString();
                        bool   bExito      = false;
                        bExito = AsientoDAC.Mayorizar(IdEjercicio, Periodo, NumAsiento, sUsuario);

                        if (!bExito)
                        {
                            MessageBox.Show("Ha ocurrido un error tratando de mayorizar el asiento..");
                            return;
                        }
                    }
                }
                MessageBox.Show("El asiento contable, se ha mayorizado con exito");

                PopulateGrid();
            }
            finally
            {
            }
        }