using ECV; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using static iTextSharp.text.pdf.PdfReader; namespace CKUERA { public partial class Inicio : Form { public Inicio() { InitializeComponent(); } public void inicio_Load(object sender, EventArgs e) { //panel1Controls.Clear(); Principal principal = new Principal(); principal.MdiParent = this; panel1.Controls.Add(principal); principal.Show(); Text = principal.Text; timer1.Enabled = true; timer1.Start(); } private void ventasToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Ventas"] != null) { //Application.OpenForms["Ventas"].Close(); MessageBox.Show("Ventas ya está abierto.\nCierre todas las otras ventanas abiertas para visualizar ''Ventas''."); return; } //if (textEstado.Text == "PRESUPUESTO") { form.checPresu.Checked = true; } Ventas form = new Ventas(); if (Global.Presupuestar == true) { form.checPresu.Checked = true; } form.MdiParent = this; panel1.Controls.Add(form); form.Show(); //menuStrip1.Enabled = false; } } private void usuariosToolStripMenuItem_Click(object sender, EventArgs e) { if(Global.USUARIO_SIST.Length> 2) { if (Global.USUARIO_RANGO != "Administrador") { return; } if (Application.OpenForms["Usuarios"] != null) { Application.OpenForms["Usuarios"].Close(); } Usuarios usuarios = new Usuarios(); usuarios.MdiParent = this; panel1.Controls.Add(usuarios); usuarios.Show(); } } private void productosToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Productos"] != null) { Application.OpenForms["Productos"].Close(); } Productos form = new Productos(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void Inicio_Resize(object sender, EventArgs e) { panel1.Height= Height; panel1.Width= Width; } private void clientesToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Clientes"] != null) { Application.OpenForms["Clientes"].Close(); } Clientes form = new Clientes(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void ingresosToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Ingresos"] != null) { Application.OpenForms["Ingresos"].Close(); } Ingresos form = new Ingresos(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void egresosToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Egresos"] != null) { Application.OpenForms["Egresos"].Close(); } Egresos form = new Egresos(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void pagaréToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Pagare"] != null) { Application.OpenForms["Pagare"].Close(); } Pagare form = new Pagare(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void reportesToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { //if (Global.USUARIO_RANGO != "Administrador") //{ // return; //} if (Application.OpenForms["Rep_ventas"] != null) { Application.OpenForms["Rep_ventas"].Close(); } Rep_ventas form = new Rep_ventas(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void vendedoresToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Global.USUARIO_RANGO != "Administrador") { return; } if (Application.OpenForms["Vendedores"] != null) { Application.OpenForms["Vendedores"].Close(); } Vendedores form = new Vendedores(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void otrasFuncionesToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["DrAutos"] != null) { Application.OpenForms["DrAutos"].Close(); } DrAutos form = new DrAutos(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void timer1_Tick(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Global.Presupuestar == true) { timer1.Stop(); timer1.Enabled = false; if (Application.OpenForms["Ventas"] != null) { Application.OpenForms["Ventas"].Close(); } Ventas form = new Ventas(); form.checPresu.Checked = true; form.checPresu.Enabled = false; form.checCon_pag.Enabled = false; form.checCred_o_Cont.Enabled = false; form.checFacturar.Enabled = false; form.TextBox1.Enabled = false; form.TextBox2.Enabled = false; form.TextBox3.Enabled = false; form.TextBox4.Enabled = false; form.RAZON_TBox.Select(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } if(Global.viene_de==1) { if (Global.Facturar == true) { timer1.Stop(); timer1.Enabled = false; if (Application.OpenForms["Ventas"] != null) { Application.OpenForms["Ventas"].Close(); } Ventas form = new Ventas(); form.checPresu.Checked = false; form.checFacturar.Checked = true; form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } } } private void ópticaToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Optica"] != null) { Application.OpenForms["Optica"].Close(); } Optica form = new Optica(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void timer2_Tick(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 0) { Principal principal = new Principal(); this.Text = Global.Text; } } private void panel1_Paint(object sender, PaintEventArgs e) { } private void monedasToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Monedas"] != null) { Application.OpenForms["Monedas"].Close(); } Monedas form = new Monedas(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void terminalCobraONoToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { //if (Global.USUARIO_RANGO != "Administrador") //{ // return; //} if (Application.OpenForms["Configvarias"] != null) { Application.OpenForms["Configvarias"].Close(); } Configvarias form = new Configvarias(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void button1_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Application.OpenForms["Ventas"] != null) { Application.OpenForms["Ventas"].Close(); } //if (textEstado.Text == "PRESUPUESTO") { form.checPresu.Checked = true; } Ventas form = new Ventas(); if (Global.Presupuestar == true) { form.checPresu.Checked = true; } form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } private void toolStripMenuItem1_Click(object sender, EventArgs e) { } private void toolStripMenuItem1_MouseMove(object sender, MouseEventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Global.US_CONFIGURA == 1 || Global.USUARIO_RANGO == "Administrador") { } else { menuStrip1.Items[1].Enabled = false; } } } private void productosToolStripMenuItem_MouseMove(object sender, MouseEventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Global.US_REGISTRA == 1 || Global.USUARIO_RANGO == "Administrador") { } else { menuStrip1.Items[2].Enabled = false; } } } private void reportesToolStripMenuItem_MouseMove(object sender, MouseEventArgs e) { if (Global.USUARIO_SIST.Length > 2) { if (Global.USUARIO_SIST.Length > 2) { if (Global.US_REPORTEVER == 1 || Global.USUARIO_RANGO == "Administrador") { } else { menuStrip1.Items[7].Enabled = false; } } } } private void regComprasToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.USUARIO_SIST.Length > 2) { //if (Global.USUARIO_RANGO != "Administrador") //{ // return; //} if (Application.OpenForms["compras_reg"] != null) { Application.OpenForms["compras_reg"].Close(); } compras_reg form = new compras_reg(); form.MdiParent = this; panel1.Controls.Add(form); form.Show(); } } } }