示例#1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.IpLocal))
     {
         this.IpLocal = DireccionIP.Local();
     }
     if (string.IsNullOrEmpty(this.IpPublica))
     {
         this.IpPublica = DireccionIP.Publica();
     }
     if (string.IsNullOrEmpty(this.SerialHDD))
     {
         this.SerialHDD = DireccionIP.SerialNumberDisk();
     }
     if (string.IsNullOrEmpty(this.Usuario))
     {
         this.Usuario = DireccionIP.SerialNumberDisk();
     }
     if (!string.IsNullOrEmpty(this.ValorPeriodo))
     {
         Frm_Reporte_Liquidacion frm_Reporte_Liquidacion = new Frm_Reporte_Liquidacion();
         LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Impresión reporte Onzas Entergadas", "Impresión Reporte");
         object[] argument = new object[]
         {
             5,
             this.ValorPeriodo
         };
         frm_Reporte_Liquidacion.EjecucionReportes(argument);
         frm_Reporte_Liquidacion.Show();
     }
     else
     {
         MessageBox.Show("Seleccione un periodo a imprimir");
     }
 }
示例#2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.IpLocal))
                {
                    this.IpLocal = DireccionIP.Local();
                }

                if (string.IsNullOrEmpty(this.IpPublica))
                {
                    this.IpPublica = DireccionIP.Publica();
                }

                if (string.IsNullOrEmpty(this.SerialHDD))
                {
                    this.SerialHDD = DireccionIP.SerialNumberDisk();
                }

                if (string.IsNullOrEmpty(this.Usuario))
                {
                    this.Usuario = DireccionIP.SerialNumberDisk();
                }

                bool indicateSave = false;
                foreach (DataGridViewRow row in dataGridView3.Rows)
                {
                    if (Convert.ToBoolean(row.Cells[0].Value))
                    {
                        break;
                    }
                }
                GuardarDatos   Guardar  = new GuardarDatos();
                SqlParameter[] ParamSQl = GuardarDatos.Parametros_OrdenesMuestreoPM("", cmbShipment.Text, dtpEvent.Value, !String.IsNullOrEmpty(/*label4.Text*/ string.Empty) ? int.Parse(/*label4.Text*/ string.Empty) : 0, cbmLabo.SelectedIndex, (true /*rbtAnalisys.Checked*/) ? /*rbtAnalisys.Checked */ true: false, 1);

                if (ParamSQl[0].Value.ToString() == "I")
                {
                    Guardar.Numerico("Sp_Guardar_OrdenMuestraPM", ParamSQl).ToString();

                    MessageBox.Show("Muestreo almacenado con Exito");
                    loadHistory();
                    //LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Registro de Muestreo " + TxbConsecutivo.Text.Trim(), "Movimiento Muestreo creado");
                    //Limpiar(1);
                }
                else
                {
                    MessageBox.Show("Personal de Muestreo actualizado con Exito");
                    //LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Personal de Muestreo " + TxbConsecutivo.Text.Trim(), "Movimiento Muestreo  Modificar");
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
示例#3
0
        private void Cargar()
        {
            c1Combo.FillC1Combo1(CboTipoComprobante, new CL_Comprobante().getTipoComprobante(), "NomTipoComprobante", "TipoComprobanteID");
            c1Combo.FillC1Combo1(cbTipoPago, new CL_Comprobante().getTipoPago(), "NomTipoPago", "TipoPagoID");
            c1Combo.FillC1Combo1(cbFormaPago, new CL_Comprobante().getFormaPago(), "NomFormaPago", "FormaPagoID");
            #region optener Nro IP
            String NombreHost;
            String DireccionIP;
            NombreHost  = Dns.GetHostName();
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU     = "";
            string NuevaIP = "";
            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');



            //traer impresoras
            CapaLogica.Users.CL_Usuario ObjUsuario = new CapaLogica.Users.CL_Usuario();
            UTI_Datatables.Dt_Configuracion = ObjUsuario.USP_M_CONFIGURACION(2, 0, "", "", "", "", AppSettings.UserID, NuevaIP);

            //traer las cajas de la sede
            DtCajas = ObjComprobante.GetCajasSedeT(NuevaIP);
            if (DtCajas.Rows.Count == 0)
            {
                NumCaja = 0;
                NomCaja = "No existe.";
                MessageBox.Show("Esta direccion IP: #" + DireccionIP + "# no esta asociada a ninguna caja", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                NumCaja = Convert.ToInt32(DtCajas.Rows[0]["Numcaja"]);
                NomCaja = DtCajas.Rows[0]["Descripcion"].ToString();
            }
            #endregion
            LblCaja.Text = NomCaja;
            //c1Combo.FillC1Combo1(cbCaja,new CL_Comprobante().GetCajasSede(AppSettings.EmpresaID + AppSettings.SedeID),"Descripcion","Numcaja");
            dtSerie = new CL_Comprobante().GetSerieComprobantes(AppSettings.EmpresaID + AppSettings.SedeID);
            cbTipoPago.SelectedIndex  = 1;
            cbFormaPago.SelectedIndex = 0;
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(TxbIdentificacion.Text.Trim()) && !String.IsNullOrEmpty(TxbNombre.Text.Trim()))
            {
                try
                {
                    if (string.IsNullOrEmpty(this.IpLocal))
                    {
                        this.IpLocal = DireccionIP.Local();
                    }

                    if (string.IsNullOrEmpty(this.IpPublica))
                    {
                        this.IpPublica = DireccionIP.Publica();
                    }

                    if (string.IsNullOrEmpty(this.SerialHDD))
                    {
                        this.SerialHDD = DireccionIP.SerialNumberDisk();
                    }

                    GuardarDatos   Guardar  = new GuardarDatos();
                    SqlParameter[] ParamSQl = GuardarDatos.Parametros_Localizacion("", TxbIdentificacion.Text.Trim(), TxbNombre.Text.Trim(), ChbEstado.Checked, txtDetail.Text);
                    if (Guardar.booleano("Sp_Guardar_Localizacion", ParamSQl))
                    {
                        if (ParamSQl[0].Value.ToString() == "I")
                        {
                            MessageBox.Show("La localización se almacenado con Exito");
                            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo localización " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim(), "Maestro Localización - Crear");
                        }
                        else
                        {
                            MessageBox.Show("La localización se ha actualizado con Exito");
                            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico la localización" + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim(), "Maestro Localización - Modificar");
                        }
                    }

                    Limpiar(1);
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.Message);
                }
            }
            else
            if (String.IsNullOrEmpty(TxbIdentificacion.Text.Trim()))
            {
                MessageBox.Show("Debe de ingresar un código");
            }
            else
            {
                MessageBox.Show("Debe de ingresar un nombre");
            }
        }
示例#5
0
        private void NotaCredito_Load(object sender, EventArgs e)
        {
            #region optener Nro IP
            String NombreHost;
            String DireccionIP;
            NombreHost  = Dns.GetHostName();
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU     = "";
            string NuevaIP = "";
            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');

            //traer las cajas de la sede
            DtCajas = ObjComprobante.GetCajasSedeT(NuevaIP);
            if (DtCajas.Rows.Count == 0)
            {
                NumCaja = 0;
                NomCaja = "No existe.";
                MessageBox.Show("Esta direccion IP: #" + DireccionIP + "# no esta asociada a ninguna caja", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                NumCaja = Convert.ToInt32(DtCajas.Rows[0]["Numcaja"]);
                NomCaja = DtCajas.Rows[0]["Descripcion"].ToString();
            }
            #endregion

            LblCaja.Text = NomCaja;
            c1Combo.FillC1Combo1(cbComprobante, new CL_Comprobante().getTipoComprobante(), "NomTipoComprobante", "TipoComprobanteID");
            c1Combo.FillC1Combo(this.c1cboCia, new CL_Empresas().GetEmpresas(), "NomEmpresa", "EmpresaID");
            this.TdgDetalleComprobante.Columns["Descontar"].Editor = this.c1NumericEdit1;// enlazar con control para que acepte solo numeros
            ocultarToolStrip();
            BtnRegistrar.Visible = false;
        }
示例#6
0
 private void CmdExaminar_Click(object sender, EventArgs e)
 {
     if (this.Txtruta.Text == string.Empty)
     {
         MessageBox.Show("Debe seleccionar un archivo para cargar.", "Carga de Análisis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         if (this.CmbTipoIngreso.Text == string.Empty)
         {
             MessageBox.Show("Debe seleccionar un tipo de ingreso para el carge del archivo de carga.", "Carga de Análisis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             if (this.Txtruta.Text != string.Empty)
             {
                 try
                 {
                     Cargar();
                     if (string.IsNullOrEmpty(this.IpLocal))
                     {
                         this.IpLocal = DireccionIP.Local();
                     }
                     if (string.IsNullOrEmpty(this.IpPublica))
                     {
                         this.IpPublica = DireccionIP.Publica();
                     }
                     if (string.IsNullOrEmpty(this.SerialHDD))
                     {
                         this.SerialHDD = DireccionIP.SerialNumberDisk();
                     }
                     if (string.IsNullOrEmpty(this.Usuario))
                     {
                         this.Usuario = DireccionIP.SerialNumberDisk();
                     }
                     LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Carga Analisis Laboratorio, Archivo " + this.descripcionArchivo, "Movimiento Muestreo creado");
                 }
                 catch (OleDbException ex)
                 {
                     MessageBox.Show(ex.Message);
                 }
             }
         }
     }
 }
示例#7
0
        private void Login_Load(object sender, EventArgs e)
        {
            //if (AppSettings.UserLatest.Length == 0)
            //    this.txtUsuario.Focus();
            //else
            //{
            //    this.txtUsuario.Text = AppSettings.UserLatest;
            //    this.txtPassword.Text = AppSettings.UserClave;
            //    this.txtPassword.Focus();
            //}
            #region nueva ip

            string NuevaIP = "";


            String NombreHost;
            String DireccionIP;
            NombreHost  = Dns.GetHostName();
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU = "";
            NuevaIP = "";
            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');
            #endregion

            //ahora se gauradara en una tabla Configuracion.Configuracion
            CapaLogica.Users.CL_Usuario ObjUsuario = new CapaLogica.Users.CL_Usuario();
            UTI_Datatables.Dt_Configuracion = ObjUsuario.USP_M_CONFIGURACION(2, 0, "", "", "", "", 0, NuevaIP);
            LblVersion.Text = "15/04/2021_" + Application.ProductVersion;
        }
        private void BtnImprimir_Click(object sender, EventArgs e)
        {
            string wProyecto = string.Empty;
            string wPeriodo  = string.Empty;

            if (cmbProyecto.SelectedIndex != 0)
            {
                wProyecto = cmbProyecto.Text;
            }

            if (cmbPeriodo.SelectedIndex != 0)
            {
                wPeriodo = cmbPeriodo.Text;
            }

            FrmRptDiarioMuestreo frmReporte = new FrmRptDiarioMuestreo(Convert.ToDateTime(dtpEventInitial.Text).ToString("yyyy-MM-dd"),
                                                                       Convert.ToDateTime(dtpEventEnd.Text).ToString("yyyy-MM-dd"), wProyecto, wPeriodo, txtNumOrden.Text);

            frmReporte.Show();
            string nameReport = "Reporte Diario Muestreo planta Maria Dama";


            if (string.IsNullOrEmpty(this.IpLocal))
            {
                this.IpLocal = DireccionIP.Local();
            }

            if (string.IsNullOrEmpty(this.IpPublica))
            {
                this.IpPublica = DireccionIP.Publica();
            }

            if (string.IsNullOrEmpty(this.SerialHDD))
            {
                this.SerialHDD = DireccionIP.SerialNumberDisk();
            }

            if (string.IsNullOrEmpty(this.Usuario))
            {
                this.Usuario = DireccionIP.SerialNumberDisk();
            }

            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se genera el reporte de " + nameReport, "Generación de Reportes");
        }
        private void CmdExaminar_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFD = new OpenFileDialog();
            openFD.Title = "Seleccionar archivos";
            openFD.Filter = "Todos los archivos  (*.xls) | *.xlsx;*.xls";
            openFD.Multiselect = false;
            openFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
            if (openFD.ShowDialog() == DialogResult.OK)
            {
                Txtruta.Text = openFD.FileName;
            }
            if (Txtruta.Text == "")
            {

            }
            else
            {
                try
                {
                    Cargar(dtgExcel, Txtruta.Text);

                    if (string.IsNullOrEmpty(this.IpLocal))
                        this.IpLocal = DireccionIP.Local();

                    if (string.IsNullOrEmpty(this.IpPublica))
                        this.IpPublica = DireccionIP.Publica();

                    if (string.IsNullOrEmpty(this.SerialHDD))
                        this.SerialHDD = DireccionIP.SerialNumberDisk();

                    if (string.IsNullOrEmpty(this.Usuario))
                        this.Usuario = DireccionIP.SerialNumberDisk();

                    LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Carga Analisis Laboratorio, Archivo " + openFD.FileName, "Movimiento Muestreo creado");

                }
                catch (OleDbException ex)
                {
                    MessageBox.Show(ex.Message);
                }

            }
        }
示例#10
0
        private void FrmCierre_Load(object sender, EventArgs e)
        {
            String NombreHost;
            String DireccionIP;

            NombreHost = Dns.GetHostName();
            CapaLogica.Users.CL_Usuario ObjUsuario = new CapaLogica.Users.CL_Usuario();
            //obtenemos las imrpesoras
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU     = "";
            string NuevaIP = "";

            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');

            //traer impresoras
            UTI_Datatables.Dt_Configuracion = ObjUsuario.USP_M_CONFIGURACION(2, 0, "", "", "", "", AppSettings.UserID, NuevaIP);

            ObtenerPuntos();

            LblEmpresa.Text      = NombreEmpresa;
            LblNroDocumento.Text = NroDocumento;
            LblRazonSocial.Text  = RazonSocial;
            LblRUC.Text          = RUC;
        }
示例#11
0
        public ManagePermissions(string User)
        {
            InitializeComponent();
            this.Usuario = User;
            comboBox1.Items.Insert(0, "Muestreo");
            comboBox1.Items.Insert(1, "Control de calidad");
            comboBox1.Items.Insert(2, "Periodo");
            comboBox1.Items.Insert(3, "Carga de resultados");
            comboBox1.Items.Insert(4, "Formulario contenedor");

            if (workingForm == null)
            {
                checkBox1.Visible = false;
                checkBox2.Visible = false;
                checkBox4.Visible = false;
            }
            if (string.IsNullOrEmpty(this.IpLocal))
            {
                this.IpLocal = DireccionIP.Local();
            }

            if (string.IsNullOrEmpty(this.IpPublica))
            {
                this.IpPublica = DireccionIP.Publica();
            }

            if (string.IsNullOrEmpty(this.SerialHDD))
            {
                this.SerialHDD = DireccionIP.SerialNumberDisk();
            }

            if (string.IsNullOrEmpty(this.Usuario))
            {
                this.Usuario = DireccionIP.SerialNumberDisk();
            }
        }
示例#12
0
        private void FrmConfigurarImpresora_Load(object sender, EventArgs e)
        {
            //agregar empresa
            c1Combo.FillC1Combo(this.c1cboCia, new CL_Empresas().GetEmpresas(), "NomEmpresa", "EmpresaID");
            c1Combo.FillC1Combo1(CboTipoComprobante, new CL_Comprobante().getTipoComprobante(), "NomTipoComprobante", "TipoComprobanteID");



            #region nueva ip
            String NombreHost;
            String DireccionIP;
            NombreHost  = Dns.GetHostName();
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU = "";
            NuevaIP = "";
            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');
            #endregion

            //ahora se gauradara en una tabla Configuracion.Configuracion

            UTI_Datatables.Dt_Configuracion = ObjUsuario.USP_M_CONFIGURACION(2, 0, "", "", "", "", 0, NuevaIP);

            DataView dv = new DataView();

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_GH_BO'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblBoletaGranja.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_GH_FA'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblFacturaGranja.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_GH_TI'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblTicketGranja.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_IH_BO'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblBoletaIndustria.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_IH_FA'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblFacturaIndustria.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_IH_TI'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblTicketIndustria.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_CH_BO'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblBoletaComercial.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_CH_FA'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblFacturaComercial.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_CH_TI'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblTicketComercial.Text = dv[0]["Data"].ToString();
            }

            dv = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo='IMP_PA'", "", DataViewRowState.CurrentRows);
            if (dv.Count > 0)
            {
                LblTicketPago.Text = dv[0]["Data"].ToString();
            }
        }
示例#13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.IpLocal))
            {
                this.IpLocal = DireccionIP.Local();
            }

            if (string.IsNullOrEmpty(this.IpPublica))
            {
                this.IpPublica = DireccionIP.Publica();
            }

            if (string.IsNullOrEmpty(this.SerialHDD))
            {
                this.SerialHDD = DireccionIP.SerialNumberDisk();
            }

            if (string.IsNullOrEmpty(this.Usuario))
            {
                this.Usuario = DireccionIP.SerialNumberDisk();
            }

            string validar = ValidarRequeridos();

            if (string.IsNullOrEmpty(validar))
            {
                if (dtpEventInitial.Value.Date > dtpDatenEnd.Value.Date)
                {
                    dtpDatenEnd.Value = DateTime.Now;
                    MessageBox.Show("La fecha final debe ser mayor a la inicial!");
                    return;
                }
                string mensaje = string.Empty;

                if (dataHistoryPeriodo.Rows.Count > 0)
                {
                    if (!selccionValor)
                    {
                        DateTime valorAnterior = Convert.ToDateTime(dataHistoryPeriodo.Rows[0].Cells[3].Value);
                        int      resultado     = DateTime.Compare(valorAnterior, Convert.ToDateTime(dtpEventInitial.Text));
                        if (resultado < 0)
                        {
                            resultado = DateTime.Compare(valorAnterior.AddDays(1), Convert.ToDateTime(dtpEventInitial.Text));

                            if (resultado != 0)
                            {
                                mensaje = "El nuevo periodo debe de ser un día posterior al final del anterior periodo";
                            }
                        }
                        else if (resultado == 0)
                        {
                            mensaje = "La fecha inicial del nuevo periodo conincide con la fecha final del anterior periodo";
                        }
                        else
                        {
                            mensaje = "El nuevo periodo esta en el rango de fechas del anterior periodo";
                        }

                        if (dataHistoryPeriodo.Rows[0].Cells[1].Value.ToString().Trim().Contains(string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim())))
                        {
                            MessageBox.Show("El periodo a crear ya existe en historial, verificar coposición del periodo");
                            return;
                        }
                    }
                }
                if (!String.IsNullOrEmpty(mensaje))
                {
                    MessageBox.Show(mensaje);
                    return;
                }
                GuardarDatos   Guardar  = new GuardarDatos();
                SqlParameter[] ParamSQl = GuardarDatos.Parametros_Insertar_PeriodoPM("", Convert.ToDateTime(dtpEventInitial.Text), Convert.ToDateTime(dtpDatenEnd.Text), Convert.ToInt32(cboAno.Text), Convert.ToInt32(cboMes.Text), cboPeriodo.Text, string.IsNullOrEmpty(txtOnzasFundidas.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtOnzasFundidas.Text.Trim())
                                                                                     , string.IsNullOrEmpty(txtRecuperacion.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtRecuperacion.Text.Trim())
                                                                                     , string.IsNullOrEmpty(txtOnzasRecuperadas.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtOnzasRecuperadas.Text.Trim()), 1);


                if (ParamSQl[0].Value.ToString() == "I")
                {
                    Guardar.booleano("Sp_Guardar_PeriodoLiquidacion", ParamSQl);
                    MessageBox.Show("Periodo almacenado con Exito");
                    LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Registro de Periodo " + string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim()), "Movimiento Periodo creado");
                }
                else
                {
                    Guardar.booleano("Sp_Modicar_PeriodoLiquidacion", ParamSQl);
                    MessageBox.Show("Periodo actualizado con Exito");
                    LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Periodo" + string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim()), "Movimiento Periodo  Modificar");
                }

                LimpiarCampos();
                loadPeriodo(Convert.ToInt32(cboAno.Text));
            }
            else
            {
                MessageBox.Show(validar);
            }
        }
示例#14
0
        private void BtnImprimir_Click(object sender, EventArgs e)
        {
            Frm_Reporte_Liquidacion frmReporte = null;

            object[] argument   = null;
            string   nameReport = string.Empty;

            //comboBox1
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                if (dtpEventInitial.Value > dtpEventEnd.Value)
                {
                    MessageBox.Show("La fecha inicial no debe de ser superior a la final");
                    return;
                }
                else
                if (dtpEventEnd.Value < dtpEventInitial.Value)
                {
                    MessageBox.Show("La fecha final no debe de ser inferior a la inicial");
                    return;
                }
                string mina = string.Empty;

                if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1))
                {
                    mina = comboMina.Text.Trim();
                }

                nameReport = "Detalle Mina Día";


                frmReporte = new Frm_Reporte_Liquidacion();
                argument   = new object[] { 1, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina };

                frmReporte.EjecucionReportes(argument);
                frmReporte.Show();
                break;

            case 1:
                if (dtpEventInitial.Value == null)
                {
                    MessageBox.Show("La fecha inicial no puede ser  Nula");
                    return;
                }
                nameReport = "Resumen Mina Día";
                mina       = string.Empty;

                if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1))
                {
                    mina = comboMina.Text.Trim();
                }

                frmReporte = new Frm_Reporte_Liquidacion();
                argument   = new object[] { 2, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina };

                frmReporte.EjecucionReportes(argument);
                frmReporte.Show();
                break;

            case 2:
                if (dtpEventInitial.Value == null)
                {
                    MessageBox.Show("La fecha inicial no puede ser  Nula");
                    return;
                }
                nameReport = "Detalle Muestreo";

                mina = string.Empty;

                if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1))
                {
                    mina = comboMina.Text.Trim();
                }

                frmReporte = new Frm_Reporte_Liquidacion();
                argument   = new object[] { 3, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina };

                frmReporte.EjecucionReportes(argument);
                frmReporte.Show();
                break;

            case -1:
                MessageBox.Show("Selcciona el Reporte a generar");
                break;

            default:
                break;
            }

            if (string.IsNullOrEmpty(this.IpLocal))
            {
                this.IpLocal = DireccionIP.Local();
            }

            if (string.IsNullOrEmpty(this.IpPublica))
            {
                this.IpPublica = DireccionIP.Publica();
            }

            if (string.IsNullOrEmpty(this.SerialHDD))
            {
                this.SerialHDD = DireccionIP.SerialNumberDisk();
            }

            if (string.IsNullOrEmpty(this.Usuario))
            {
                this.Usuario = DireccionIP.SerialNumberDisk();
            }

            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se genera el reporte de " + nameReport, "Generación de Reportes");
        }
示例#15
0
        private void BtnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (TdgComprobantes.RowCount > 0)
                {
                    string NumComprobante = this.TdgComprobantes.Columns["NumComprobante"].Value.ToString();
                    string SERIE          = this.TdgComprobantes.Columns["SERIE"].Value.ToString();
                    string NUMERO         = this.TdgComprobantes.Columns["NUMERO"].Value.ToString();
                    if (MessageBox.Show("¿Seguro que desea imprimir el comprobante " + SERIE + "-" + NUMERO + "?", "Aviso", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        Int64 ComprobanteId = Convert.ToInt64(this.TdgComprobantes.Columns["ComprobanteId"].Value);
                        hojaimpresa = 1;

                        DS         = objVenta.ObtenerParaImpresion(ComprobanteId);
                        dtcabecera = DS.Tables[0];
                        dtdetalle  = DS.Tables[1];

                        //seleccionar impresora

                        #region optener Nro IP
                        String NombreHost;
                        String DireccionIP;
                        NombreHost  = Dns.GetHostName();
                        DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
                        //MessageBox.Show(DireccionIP);
                        //dar formato a la direccion IP
                        string ACU     = "";
                        string NuevaIP = "";
                        for (int X = 0; X < DireccionIP.Length; X++)
                        {
                            string Valor = DireccionIP.Substring(X, 1);
                            if (Valor != ".")
                            {
                                ACU += Valor;
                            }
                            else
                            {
                                NuevaIP += ACU.PadLeft(3, '0') + ".";
                                ACU      = "";
                            }
                        }
                        NuevaIP += ACU.PadLeft(3, '0');
                        #endregion

                        //traer impresoras
                        CapaLogica.Users.CL_Usuario ObjUsuario = new CapaLogica.Users.CL_Usuario();
                        UTI_Datatables.Dt_Configuracion = ObjUsuario.USP_M_CONFIGURACION(2, 0, "", "", "", "", AppSettings.UserID, NuevaIP);

                        string EMPRESA_ID       = dtcabecera.Rows[0]["EmpresaID"].ToString();
                        string TIPO_COMPROBANTE = "";

                        TIPO_COMPROBANTE = "TI";

                        //ahora se gauradara en una tabla Configuracion.Configuracion

                        DataView DV = new DataView(UTI_Datatables.Dt_Configuracion, "Codigo ='" + "IMP_" + EMPRESA_ID + "_" + TIPO_COMPROBANTE + "'", "", DataViewRowState.CurrentRows);

                        if (DV.Count > 0)
                        {
                            printDocument1.PrinterSettings.PrinterName = DV[0]["Data"].ToString();
                            printDocument1.Print();
                        }
                        else
                        {
                            MessageBox.Show("No existe una impresora configurada, por favor agregela \n(seleccionar impresora ticket en venta)", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }


                        if (printDocument1.PrinterSettings.PrinterName == "")
                        {
                            MessageBox.Show("Al parecer no se ha seleccionado la impresora. no se imprimira el comprobante.\n(seleccionar impresora ticket en venta)", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            Cursor = Cursors.Default;
                            return;
                        }
                        //fin seleccionar imrepsora
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#16
0
文件: Pago.cs 项目: julioanyosa/ERPH
        private void Pago_Load(object sender, EventArgs e)
        {
            DtFormasPago = new CL_Comprobante().getFormaPago();
            c1Combo.FillC1Combo1(cbComprobante, new CL_Comprobante().getTipoComprobante(), "NomTipoComprobante", "TipoComprobanteID");
            c1Combo.FillC1Combo(this.c1cboCia, new CL_Empresas().GetEmpresas(), "NomEmpresa", "EmpresaID");
            c1Combo.FillC1Combo1(cbFormaPago, DtFormasPago, "NomFormaPago", "FormaPagoID");
            DtClientes = new CL_Cliente().GetClientes();
            useCliente1.Cargar(DtClientes);
            useCliente1.btnRegistrar.Visible = false;
            PnCampanha.Visible    = true;
            PnComprobante.Visible = false;


            //traer empresas
            DtEmpresas = new CL_Empresas().GetEmpresas();

            TxtDeudaTotal.ReadOnly          = true;
            TxtTotalPagado.ReadOnly         = true;
            TxtPorPagar.ReadOnly            = true;
            TxtImporteComprobante.ReadOnly  = true;
            TxtPagadoComprobante.ReadOnly   = true;
            TxtPorPagarComprobante.ReadOnly = true;
            TxtFechaEmision.ReadOnly        = true;
            ocultarToolStrip();

            c1cboCia.SelectedValue    = AppSettings.EmpresaID;
            cbFormaPago.SelectedValue = 1;

            #region optener Nro IP
            String NombreHost;
            String DireccionIP;
            NombreHost  = Dns.GetHostName();
            DireccionIP = System.Net.Dns.GetHostByName(NombreHost).AddressList[0] + "";
            //MessageBox.Show(DireccionIP);
            //dar formato a la direccion IP
            string ACU     = "";
            string NuevaIP = "";
            for (int X = 0; X < DireccionIP.Length; X++)
            {
                string Valor = DireccionIP.Substring(X, 1);
                if (Valor != ".")
                {
                    ACU += Valor;
                }
                else
                {
                    NuevaIP += ACU.PadLeft(3, '0') + ".";
                    ACU      = "";
                }
            }
            NuevaIP += ACU.PadLeft(3, '0');

            //traer las cajas de la sede
            DtCajas = ObjComprobante.GetCajasSedeT(NuevaIP);
            if (DtCajas.Rows.Count == 0)
            {
                NumCaja = 0;
                NomCaja = "No existe.";
                MessageBox.Show("Esta direccion IP: #" + DireccionIP + "# no esta asociada a ninguna caja", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                NumCaja = Convert.ToInt32(DtCajas.Rows[0]["Numcaja"]);
                NomCaja = DtCajas.Rows[0]["Descripcion"].ToString();
            }

            LblCaja.Text = NomCaja;
            #endregion
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            int rol   = 0;
            int Error = 0;

            if (!ChbCuartea.Checked && !ChbEncargado.Checked && !ChbSeguridad.Checked && !ChbTercero.Checked)
            {
                Error = 1;
            }
            else
            if (ChbEncargado.Checked)
            {
                rol = 1;
            }
            else
            {
                if (ChbSeguridad.Checked)
                {
                    rol = 2;
                }
                else
                {
                    if (ChbTercero.Checked)
                    {
                        rol = 3;
                    }
                    else
                    {
                        rol = 4;
                    }
                }
            }


            if (TxbIdentificacion.Text.Trim().Length == 0)
            {
                Error = 2;
            }
            if (Error == 0)
            {
                try
                {
                    if (string.IsNullOrEmpty(this.IpLocal))
                    {
                        this.IpLocal = DireccionIP.Local();
                    }

                    if (string.IsNullOrEmpty(this.IpPublica))
                    {
                        this.IpPublica = DireccionIP.Publica();
                    }

                    if (string.IsNullOrEmpty(this.SerialHDD))
                    {
                        this.SerialHDD = DireccionIP.SerialNumberDisk();
                    }

                    GuardarDatos   Guardar  = new GuardarDatos();
                    SqlParameter[] ParamSQl = GuardarDatos.Parametros_PersonalMuestreo("", TxbIdentificacion.Text.Trim(), TxbNombre.Text.Trim(), TxbApellido.Text.Trim(), TxbDireccion.Text.Trim(), TxbTelFijo.Text.Trim(), TxbCelular.Text.Trim(), TxbEmail.Text.Trim(), rol, Convertir.ImagenEnByte(PtbPersonal.Image), ChbEstado.Checked, DtpCreado.Value);
                    if (Guardar.booleano("Sp_Guardar_PersonalMuestreo", ParamSQl))
                    {
                        Limpiar(1);

                        if (ParamSQl[0].Value.ToString() == "I")
                        {
                            MessageBox.Show("Personal de Muestreo almacenado con Exito");
                            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Personal de Muestreo " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim() + " " + TxbApellido.Text.Trim(), "Maestros - Crear");
                        }
                        else
                        {
                            MessageBox.Show("Personal de Muestreo actualizado con Exito");
                            LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Personal de Muestreo " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim() + " " + TxbApellido.Text.Trim(), "Maestros - Modificar");
                        }
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.Message);
                }
            }
            if (Error == 1)
            {
                MessageBox.Show("Debe Seleccionar un tipo de Rol del Personal. ( Encargado / Seguridad / Tercero / Cuarte)");
            }
            if (Error == 2)
            {
                MessageBox.Show("Debe reportar una identificacion");
            }
        }
示例#18
0
        private void Save_Click(object sender, EventArgs e)
        {
            SqlConnection conn = Conexion.OpenConexion();

            SqlParameter param;

            foreach (String controlID in PageControls.SelectedItems)
            {
                foreach (DataRowView roleRow in PermissionRoles.SelectedItems)
                {
                    int roleID = Convert.ToInt32(roleRow["RoleID"]);
                    try
                    {
                        SqlCommand cmd = new SqlCommand();
                        cmd.Connection  = conn;
                        cmd.CommandText = "spInsertNewControlToRole";
                        cmd.CommandType = CommandType.StoredProcedure;

                        param           = cmd.Parameters.Add("@RoleID", SqlDbType.Int);
                        param.Value     = roleID;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@PageName", SqlDbType.VarChar, 50);
                        param.Value     = workingForm.Name.ToString();
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@ControlID", SqlDbType.VarChar, 50);
                        param.Value     = controlID;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@invisible", SqlDbType.Int);
                        param.Value     = InVisible.Checked ? 1 : 0;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@disabled", SqlDbType.Int);
                        param.Value     = Disabled.Checked ? 1 : 0;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@ContenedorPeqMineria", SqlDbType.Int);
                        param.Value     = checkBox1.Checked ? 1 : 0;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@ContenedorZandor", SqlDbType.Int);
                        param.Value     = checkBox2.Checked ? 1 : 0;
                        param.Direction = ParameterDirection.Input;

                        param           = cmd.Parameters.Add("@ContenedorOtros", SqlDbType.Int);
                        param.Value     = checkBox4.Checked ? 1 : 0;
                        param.Direction = ParameterDirection.Input;
                        //}

                        int rowsInserted = cmd.ExecuteNonQuery();
                        if (rowsInserted < 1 || rowsInserted > 2)
                        {
                            DisplayError(controlID, roleID, "Registros insertados= " + rowsInserted.ToString());
                        }

                        if (string.IsNullOrEmpty(this.IpLocal))
                        {
                            this.IpLocal = DireccionIP.Local();
                        }

                        if (string.IsNullOrEmpty(this.IpPublica))
                        {
                            this.IpPublica = DireccionIP.Publica();
                        }

                        if (string.IsNullOrEmpty(this.SerialHDD))
                        {
                            this.SerialHDD = DireccionIP.SerialNumberDisk();
                        }

                        if (string.IsNullOrEmpty(this.Usuario))
                        {
                            this.Usuario = DireccionIP.SerialNumberDisk();
                        }

                        LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Creación de permisos", "Asignación de permisos");
                    }
                    catch (Exception ex)
                    {
                        DisplayError(controlID, roleID, ex.Message);
                    }
                }
            }
            conn.Close();
            PopulatePermissionTree();
        }