private void ValidaLocal(String NameLocal)
        {
            if (NameLocal.Trim().Length > 0)
            {
                var BL = new sys_localBL();
                var BE = new tb_sys_local();

                var dt = new DataTable();
                BE.dominioid = dominio.ToString().Trim();
                BE.moduloid = modulo.ToString().Trim();
                BE.local = NameLocal.Trim().ToString();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    loc_id.Text = dt.Rows[0]["local"].ToString().Trim();
                    loc_name.Text = dt.Rows[0]["localname"].ToString().Trim();
                }
                else
                {
                    loc_id.Text = string.Empty;
                    loc_name.Text = string.Empty;
                }
            }
        }
        private void data_Tablamodulo()
        {
            try
            {
                if (Tablamodulo != null)

                    Tablamodulo.Rows.Clear();

                sys_localBL BL = new sys_localBL();
                tb_sys_local BE = new tb_sys_local();

                BE.dominioid = dominio.ToString();
                BE.moduloid = modulo.ToString(); ;

                Tablamodulo = BL.GetAll(EmpresaID, BE).Tables[0];

                if (Tablamodulo.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    dgb_local.DataSource = Tablamodulo;
                    dgb_local.Rows[0].Selected = false;
                    dgb_local.Focus();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void get_dominio_modulo_local(string dominioid, string moduloid)
        {
            if (moduloid.ToString().Length == 4 && moduloid.ToString() != "0000")
            {
                var BL = new sys_localBL();
                var BE = new tb_sys_local();
                BE.dominioid = dominioid;
                BE.moduloid = moduloid;

                var dt = new DataTable();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    localdes.DataSource = dt;
                    localdes.ValueMember = "local";
                    localdes.DisplayMember = "localname";
                }
            }
        }
        private void data_cbo_localdes(String dominioid, String moduloid)
        {
            try
            {
                var BL = new sys_localBL();
                var BE = new tb_sys_local();
                BE.dominioid = dominioid;
                BE.moduloid = moduloid;

                var dt = new DataTable();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    VariablesPublicas.localdirec = dt.Rows[0]["localdirec"].ToString();
                    VariablesPublicas.telef = dt.Rows[0]["telef"].ToString();
                }

                localdes.DataSource = dt;
                localdes.ValueMember = "local";
                localdes.DisplayMember = "localname";
                localdes.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_busqueda_Click(object sender, EventArgs e)
        {
            sys_localBL BL = new sys_localBL();
            tb_sys_local BE = new tb_sys_local();

            DataTable dt = new DataTable();

            //BE.dominioid = dominioid.Text.Trim();
            //BE.moduloid = moduloid.Text.Trim();
            BE.localname = txt_busqueda.Text.ToString();

            dt = BL.GetAll(EmpresaID, BE).Tables[0];

            if (dt.Rows.Count > 0)
            {
                dgb_local.DataSource = dt;
            }
        }
Exemplo n.º 6
0
        private void _ManejaListPrec()
        {
            var BL = new sys_localBL();
            var BE = new tb_sys_local();
            var dt = new DataTable();
            BE.dominioid = dominio.ToString();
            BE.moduloid = modulo.ToString();
            BE.local = local.ToString();

            dt = BL.GetAll(EmpresaID, BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                ManejaListPrec = Convert.ToBoolean(dt.Rows[0]["manejalistprec"].ToString());
            }
        }
Exemplo n.º 7
0
        public void StatusBar()
        {
            lblUsuario.Text = VariablesPublicas.Nombr;
            lblCompany.Text = VariablesPublicas.EmpresaName;
            lblPeriodo.Text = perianio;    //VariablesPublicas.perianio;

            var BL2 = new sys_localBL();
            var BE2 = new tb_sys_local();
            var dt2 = new DataTable();
            BE2.dominioid = dominioid; // VariablesPublicas.Dominioid.ToString();
            BE2.moduloid = moduloid; //VariablesPublicas.Moduloid.ToString();
            BE2.local = local; //VariablesPublicas.Local.ToString();
            dt2 = BL2.GetAll(VariablesPublicas.EmpresaID, BE2).Tables[0];
            if (dt2.Rows.Count > 0)
            {
                var xxmesid = string.Empty;
                if (Convert.ToBoolean(dt2.Rows[0]["perimeslocal"]))
                {
                    xxmesid = perimes;
                    lblncaja.Text = _cajanume.ToString();
                }
                else
                {
                    xxmesid = perimes; //VariablesPublicas.perimes.ToString();
                    lblncaja.Text = _cajanume.ToString();
                }
                //var BL = new tb_co_mesesBL();
                //var dt = new DataTable();
                //dt = BL.GetOne(VariablesPublicas.EmpresaID, xxmesid.ToString()).Tables[0];
                //if (dt.Rows.Count > 0)
                //{
                //    lblperimes.Text = dt.Rows[0]["mesname"].ToString();
                //}
            }

            //lblalmacen.Text = VariablesPublicas.EmpresaTipo;
            lblalmacen.Text = moduloname;
            lblVersion.Text = ProductVersion;

            TituloForm = "ERP - Bapsoft.Net - " + moduloname + " - ";
            //Text = ((TituloForm + lblCompany.Text + "  »» LOCAL »»  " + VariablesPublicas.nombrelocal.ToString()));
            Text = ((TituloForm + lblCompany.Text + "  »» LOCAL »»  " + localname));
        }
Exemplo n.º 8
0
        private void get_val_fechadoc()
        {
            try
            {
                var BL = new constantesgeneralesBL();
                var dt = new DataTable();

                dt = BL.GetOne(EmpresaID, dominio, modulo, local).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    perianio = dt.Rows[0]["perianio"].ToString().Trim();

                    var BL2 = new sys_localBL();
                    var BE2 = new tb_sys_local();
                    var dt2 = new DataTable();
                    BE2.dominioid = dominio.ToString();
                    BE2.moduloid = modulo.ToString();
                    ;
                    BE2.local = local.ToString();
                    dt2 = BL2.GetAll(VariablesPublicas.EmpresaID, BE2).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        // Lo que esta comentado es para validar con el perimes del  => BapConfig.cfg

                        //if (Convert.ToBoolean(dt2.Rows[0]["perimeslocal"]))
                        //{
                        //    perimes = _perimes;
                        //}
                        //else
                        //{
                            perimes = dt.Rows[0]["perimes"].ToString().Trim();
                        //}
                    }
                    if (dt.Rows[0]["fechadocedit"].ToString().Trim().Length > 0)
                    {
                        fechadocedit = Convert.ToBoolean(dt.Rows[0]["fechadocedit"]);
                    }
                }

                var fechaactual = DateTime.Today;
                var fechaperiodo = Convert.ToDateTime("01" + "/" + perimes + "/" + perianio);

                if (fechadocedit)
                {
                    var primerdia = new DateTime(fechaperiodo.Year, fechaperiodo.Month, 1);
                    var ultimodia = primerdia.AddMonths(1).AddDays(-1);
                    if (fechaactual.Day <= ultimodia.Day)
                    {
                        fechdoc.Value = Convert.ToDateTime(fechaactual.Day + "/" + perimes + "/" + perianio);
                    }
                    else
                    {
                        fechdoc.Value = Convert.ToDateTime(ultimodia.Day + "/" + perimes + "/" + perianio);
                    }
                    fechdoc.MaxDate = ultimodia;
                    fechdoc.MinDate = primerdia;
                }
                else
                {
                    if (fechaactual.Month == fechaperiodo.Month && fechaactual.Year == fechaperiodo.Year)
                    {
                        fechdoc.Value = fechaactual;
                    }
                    else
                    {
                        MessageBox.Show("Actualizar a periodo actual en tabla constantes generales !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        statusDoc = false;
                    }
                }
                get_tipocambio(fechdoc.Text);
                get_tipimptoid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                statusDoc = false;
            }
        }
        private void cboLocal_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboLocal.SelectedIndex != -1)
            {
                get_constantesGen(cboDominioID.SelectedValue.ToString(), cboModuloID.SelectedValue.ToString(), cboLocal.SelectedValue.ToString());
            }

            var BE = new tb_sys_local();

            BE.moduloid = cboModuloID.SelectedValue.ToString();
            BE.dominioid = cboDominioID.SelectedValue.ToString();
            BE.local = cboLocal.SelectedValue.ToString();

            try
            {
                var BL = new sys_localBL();
                var dt2 = new DataTable();
                var empresaid = string.Empty;
                empresaid = VariablesPublicas.EmpresaID;
                dt2 = BL.GetAll(empresaid, BE).Tables[0];

                if (dt2.Rows.Count > 0)
                {
                    VariablesPublicas.EmpresaEstablec = dt2.Rows[0]["localname"].ToString();
                    VariablesPublicas.localfeuiv = dt2.Rows[0]["localfeuiv"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ValidaLocal()
        {
            if (xlocal.Text.Trim().Length > 0)
            {
                var BL = new sys_localBL();
                var BE = new tb_sys_local();
                var dt = new DataTable();

                BE.dominioid = dominioid.Text.Trim();
                BE.moduloid = moduloid.Text.Trim();
                BE.local = xlocal.Text.Trim().PadLeft(3, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    xlocal.Text = dt.Rows[0]["local"].ToString().Trim();
                    localname.Text = dt.Rows[0]["localname"].ToString().Trim();

                    tipodoc.Enabled = true;
                    tipodoc.Focus();
                }
                else
                {
                    xlocal.Text = string.Empty;
                    localname.Text = string.Empty;
                    xlocal.Enabled = true;
                }
            }
            else
            {
                xlocal.Text = string.Empty;
                localname.Text = string.Empty;
                xlocal.Enabled = true;
            }
        }
Exemplo n.º 11
0
        private void cboLocal_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboLocal.SelectedIndex != -1)
            {
                get_constantesGen(cboDominioID.SelectedValue.ToString(), cboModuloID.SelectedValue.ToString(), cboLocal.SelectedValue.ToString());
            }

            var BE = new tb_sys_local();

            BE.moduloid = cboModuloID.SelectedValue.ToString();
            BE.dominioid = cboDominioID.SelectedValue.ToString();
            BE.local = cboLocal.SelectedValue.ToString();

            try
            {
                var BL = new sys_localBL();
                var dt2 = new DataTable();
                var empresaid = string.Empty;
                if (Equivalencias.Left(cboEmpresa.Text, 2) == "[0")
                {
                    empresaid = "01";
                }
                else
                {
                    empresaid = Equivalencias.Left(cboEmpresa.Text, 2);
                }

                dt2 = BL.GetAll(empresaid, BE).Tables[0];

                if (dt2.Rows.Count > 0)
                {
                    _localname = dt2.Rows[0]["localname"].ToString();
                    _localfeuiv = Convert.ToDateTime(dt2.Rows[0]["localfeuiv"]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void get_val_fechadoc()
        {
            try
            {
                constantesgeneralesBL BL = new constantesgeneralesBL();
                tb_constantesgenerales BE = new tb_constantesgenerales();
                DataTable dt = new DataTable();

                dt = BL.GetOne(EmpresaID, dominio, modulo, local).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    perianio = dt.Rows[0]["perianio"].ToString().Trim();
                    // Vamos Obtener el Check de Perimes Local Para Usar el Perimes de Constanantes o del Bapconfig
                    var BL2 = new sys_localBL();
                    var BE2 = new tb_sys_local();
                    DataTable dt2 = new DataTable();
                    BE2.dominioid = dominio.ToString();
                    BE2.moduloid = modulo.ToString(); ;
                    BE2.local = local.ToString();
                    dt2 = BL2.GetAll(VariablesPublicas.EmpresaID, BE2).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        if (Convert.ToBoolean(dt2.Rows[0]["perimeslocal"]))
                        {
                            // Hemos Fijado el Perimes en BapConfig
                            perimes = _perimes;
                        }
                        else
                        {
                            // Ponemos el Perimes de Constantes Generales
                            perimes = dt.Rows[0]["perimes"].ToString().Trim();
                        }
                    }
                    if (dt.Rows[0]["fechadocedit"].ToString().Trim().Length > 0)
                    {
                        fechadocedit = Convert.ToBoolean(dt.Rows[0]["fechadocedit"]);
                    }
                }

                DateTime fechaactual = DateTime.Today;
                DateTime fechaperiodo = Convert.ToDateTime("01" + "/" + perimes + "/" + perianio);

                if (fechadocedit)
                {
                    //DateTime primerdia = new DateTime(fechaperiodo.Year, fechaperiodo.Month, 1);
                    //DateTime ultimodia = primerdia.AddMonths(1).AddDays(-1);
                    //if (fechaactual.Day <= ultimodia.Day)
                    //{
                    //    fechdoc.Value = Convert.ToDateTime(fechaactual.Day + "/" + perimes + "/" + perianio);
                    //}
                    //else
                    //{
                    //    fechdoc.Value = Convert.ToDateTime(ultimodia.Day + "/" + perimes + "/" + perianio);
                    //}
                    //fechdoc.MaxDate = ultimodia;
                    //fechdoc.MinDate = primerdia;
                }
                else
                {
                    if (fechaactual.Month == fechaperiodo.Month && fechaactual.Year == fechaperiodo.Year)
                    {
                        fechdoc.Value = fechaactual;
                        //fechdoc.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("Actualizar a Periodo Actual en Tabla Constantes Generales !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        statusDoc = false;
                    }
                }
                get_tipocambio(fechdoc.Text);
                get_tipimptoid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                statusDoc = false;
            }
        }